Line
Link Here
|
0 |
-- a/grub/asmstub.c |
0 |
++ b/grub/asmstub.c |
Lines 1037-1043
hex_dump (void *buf, size_t size)
Link Here
|
1037 |
|
1037 |
|
1038 |
int |
1038 |
int |
1039 |
biosdisk (int subfunc, int drive, struct geometry *geometry, |
1039 |
biosdisk (int subfunc, int drive, struct geometry *geometry, |
1040 |
unsigned int sector, int nsec, int segment) |
1040 |
int sector, int nsec, int segment) |
1041 |
{ |
1041 |
{ |
1042 |
char *buf; |
1042 |
char *buf; |
1043 |
int fd = geometry->flags; |
1043 |
int fd = geometry->flags; |
1044 |
-- a/lib/device.c |
1044 |
++ b/lib/device.c |
Lines 69-77
struct hd_geometry
Link Here
|
69 |
# ifndef CDROM_GET_CAPABILITY |
69 |
# ifndef CDROM_GET_CAPABILITY |
70 |
# define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ |
70 |
# define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ |
71 |
# endif /* ! CDROM_GET_CAPABILITY */ |
71 |
# endif /* ! CDROM_GET_CAPABILITY */ |
72 |
# ifndef BLKGETSIZE64 |
72 |
# ifndef BLKGETSIZE |
73 |
# define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size */ |
73 |
# define BLKGETSIZE _IO(0x12,96) /* return device size */ |
74 |
# endif /* ! BLKGETSIZE64 */ |
74 |
# endif /* ! BLKGETSIZE */ |
75 |
#endif /* __linux__ */ |
75 |
#endif /* __linux__ */ |
76 |
|
76 |
|
77 |
/* Use __FreeBSD_kernel__ instead of __FreeBSD__ for compatibility with |
77 |
/* Use __FreeBSD_kernel__ instead of __FreeBSD__ for compatibility with |
Lines 297-312
get_drive_geometry (struct geometry *geom, char **map, int drive)
Link Here
|
297 |
#if defined(__linux__) |
297 |
#if defined(__linux__) |
298 |
/* Linux */ |
298 |
/* Linux */ |
299 |
{ |
299 |
{ |
300 |
unsigned long long nr; |
300 |
unsigned long nr; |
301 |
|
301 |
|
302 |
if (ioctl (fd, BLKGETSIZE64, &nr)) |
302 |
if (ioctl (fd, BLKGETSIZE, &nr)) |
303 |
goto fail; |
303 |
goto fail; |
304 |
|
304 |
|
305 |
/* Got the geometry, so save it. */ |
305 |
/* Got the geometry, so save it. */ |
306 |
get_linux_geometry(fd, geom); |
306 |
get_linux_geometry(fd, geom); |
307 |
if (!geom->heads && !geom->cylinders && !geom->sectors) |
307 |
if (!geom->heads && !geom->cylinders && !geom->sectors) |
308 |
goto fail; |
308 |
goto fail; |
309 |
geom->total_sectors = nr / 512; |
309 |
geom->total_sectors = nr; |
310 |
|
310 |
|
311 |
goto success; |
311 |
goto success; |
312 |
} |
312 |
} |
313 |
-- a/stage2/bios.c |
313 |
++ b/stage2/bios.c |
Lines 47-53
extern int get_diskinfo_floppy (int drive,
Link Here
|
47 |
return the error number. Otherwise, return 0. */ |
47 |
return the error number. Otherwise, return 0. */ |
48 |
int |
48 |
int |
49 |
biosdisk (int read, int drive, struct geometry *geometry, |
49 |
biosdisk (int read, int drive, struct geometry *geometry, |
50 |
unsigned int sector, int nsec, int segment) |
50 |
int sector, int nsec, int segment) |
51 |
{ |
51 |
{ |
52 |
int err; |
52 |
int err; |
53 |
|
53 |
|
54 |
-- a/stage2/disk_io.c |
54 |
++ b/stage2/disk_io.c |
Lines 138-144
log2 (unsigned long word)
Link Here
|
138 |
} |
138 |
} |
139 |
|
139 |
|
140 |
int |
140 |
int |
141 |
rawread (int drive, unsigned int sector, int byte_offset, int byte_len, char *buf) |
141 |
rawread (int drive, int sector, int byte_offset, int byte_len, char *buf) |
142 |
{ |
142 |
{ |
143 |
int slen, sectors_per_vtrack; |
143 |
int slen, sectors_per_vtrack; |
144 |
int sector_size_bits = log2 (buf_geom.sector_size); |
144 |
int sector_size_bits = log2 (buf_geom.sector_size); |
Lines 262-268
rawread (int drive, unsigned int sector, int byte_offset, int byte_len, char *bu
Link Here
|
262 |
*/ |
262 |
*/ |
263 |
if (disk_read_func) |
263 |
if (disk_read_func) |
264 |
{ |
264 |
{ |
265 |
unsigned int sector_num = sector; |
265 |
int sector_num = sector; |
266 |
int length = buf_geom.sector_size - byte_offset; |
266 |
int length = buf_geom.sector_size - byte_offset; |
267 |
if (length > size) |
267 |
if (length > size) |
268 |
length = size; |
268 |
length = size; |
Lines 292-298
rawread (int drive, unsigned int sector, int byte_offset, int byte_len, char *bu
Link Here
|
292 |
|
292 |
|
293 |
|
293 |
|
294 |
int |
294 |
int |
295 |
devread (unsigned int sector, int byte_offset, int byte_len, char *buf) |
295 |
devread (int sector, int byte_offset, int byte_len, char *buf) |
296 |
{ |
296 |
{ |
297 |
/* |
297 |
/* |
298 |
* Check partition boundaries |
298 |
* Check partition boundaries |
Lines 331-337
devread (unsigned int sector, int byte_offset, int byte_len, char *buf)
Link Here
|
331 |
|
331 |
|
332 |
#ifndef STAGE1_5 |
332 |
#ifndef STAGE1_5 |
333 |
int |
333 |
int |
334 |
rawwrite (int drive, unsigned int sector, char *buf) |
334 |
rawwrite (int drive, int sector, char *buf) |
335 |
{ |
335 |
{ |
336 |
if (sector == 0) |
336 |
if (sector == 0) |
337 |
{ |
337 |
{ |
Lines 364-370
rawwrite (int drive, unsigned int sector, char *buf)
Link Here
|
364 |
} |
364 |
} |
365 |
|
365 |
|
366 |
int |
366 |
int |
367 |
devwrite (unsigned int sector, int sector_count, char *buf) |
367 |
devwrite (int sector, int sector_count, char *buf) |
368 |
{ |
368 |
{ |
369 |
#if defined(GRUB_UTIL) && defined(__linux__) |
369 |
#if defined(GRUB_UTIL) && defined(__linux__) |
370 |
if (current_partition != 0xFFFFFF |
370 |
if (current_partition != 0xFFFFFF |
371 |
-- a/stage2/shared.h |
371 |
++ b/stage2/shared.h |
Lines 813-819
int checkkey (void);
Link Here
|
813 |
/* Low-level disk I/O */ |
813 |
/* Low-level disk I/O */ |
814 |
int get_diskinfo (int drive, struct geometry *geometry); |
814 |
int get_diskinfo (int drive, struct geometry *geometry); |
815 |
int biosdisk (int subfunc, int drive, struct geometry *geometry, |
815 |
int biosdisk (int subfunc, int drive, struct geometry *geometry, |
816 |
unsigned int sector, int nsec, int segment); |
816 |
int sector, int nsec, int segment); |
817 |
void stop_floppy (void); |
817 |
void stop_floppy (void); |
818 |
|
818 |
|
819 |
/* Command-line interface functions. */ |
819 |
/* Command-line interface functions. */ |
Lines 927-936
int gunzip_test_header (void);
Link Here
|
927 |
int gunzip_read (char *buf, int len); |
927 |
int gunzip_read (char *buf, int len); |
928 |
#endif /* NO_DECOMPRESSION */ |
928 |
#endif /* NO_DECOMPRESSION */ |
929 |
|
929 |
|
930 |
int rawread (int drive, unsigned int sector, int byte_offset, int byte_len, char *buf); |
930 |
int rawread (int drive, int sector, int byte_offset, int byte_len, char *buf); |
931 |
int devread (unsigned int sector, int byte_offset, int byte_len, char *buf); |
931 |
int devread (int sector, int byte_offset, int byte_len, char *buf); |
932 |
int rawwrite (int drive, unsigned int sector, char *buf); |
932 |
int rawwrite (int drive, int sector, char *buf); |
933 |
int devwrite (unsigned int sector, int sector_len, char *buf); |
933 |
int devwrite (int sector, int sector_len, char *buf); |
934 |
|
934 |
|
935 |
/* Parse a device string and initialize the global parameters. */ |
935 |
/* Parse a device string and initialize the global parameters. */ |
936 |
char *set_device (char *device); |
936 |
char *set_device (char *device); |