From a936d039219a13c603304efe01ff2f3666049a81 Mon Sep 17 00:00:00 2001 From: okuji Date: Tue, 22 Feb 2000 07:25:17 +0000 Subject: [PATCH] change the location of the boot partition table. --- ChangeLog | 18 ++++++++++++++++++ grub/asmstub.c | 5 +++-- stage2/builtins.c | 15 ++++++++++----- stage2/disk_io.c | 4 ++-- stage2/shared.h | 8 ++++++-- 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0227a679..8ba480381 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2000-02-21 OKUJI Yoshinori + + * stage2/disk_io.c (check_BSD_parts) [!STAGE1_5]: Use the term + "BSD sub-partition" instead of "BSD slice" for consistency. + + * stage2/builtins.c (boot_func): Copy the partition table to + BOOT_PART_TABLE instead of (BOOTSEC_LOCATION + + BOOTSEC_PART_OFFSET). Don't use grub_memmove, but copy it + directly, since memcheck is too strict. + * stage2/disk_io.c (real_open_partition) [!STAGE1_5]: Set + CUR_PART_ADDR to (BOOT_PART_TABLE + (i << 4)). + * stage2/shared.h (BOOT_PART_TABLE): New macro. + (chain_stage1): Change the types of all the arguments to + unsigned long. + (chain_stage2): Likewise. + * grub/asmstub.c (chain_stage1): Adjusted to the prototype. + (chain_stage2): Likewise. + 2000-02-21 OKUJI Yoshinori * stage2/disk_io.c (check_BSD_parts) [!STAGE1_5]: If the BSD diff --git a/grub/asmstub.c b/grub/asmstub.c index a11218552..3db358048 100644 --- a/grub/asmstub.c +++ b/grub/asmstub.c @@ -580,14 +580,15 @@ stop (void) /* calls for direct boot-loader chaining */ void -chain_stage1 (int segment, int offset, int part_table_addr) +chain_stage1 (unsigned long segment, unsigned long offset, + unsigned long part_table_addr) { stop (); } void -chain_stage2 (int segment, int offset) +chain_stage2 (unsigned long segment, unsigned long offset) { stop (); } diff --git a/stage2/builtins.c b/stage2/builtins.c index a93040588..a490266d3 100644 --- a/stage2/builtins.c +++ b/stage2/builtins.c @@ -218,10 +218,12 @@ boot_func (char *arg, int flags) gateA20 (0); boot_drive = saved_drive; - /* Copy the boot partition information to the chain-loader, if + /* Copy the boot partition information to 0x7be-0x7fd, if BOOT_DRIVE is a hard disk drive. */ if (boot_drive & 0x80) { + char *dst, *src; + /* Read the MBR here, because it might be modified after opening the partition. */ if (! rawread (boot_drive, boot_part_offset, @@ -232,10 +234,13 @@ boot_func (char *arg, int flags) return 0; } - /* Need only the partition table. */ - grub_memmove ((char *) BOOTSEC_LOCATION + BOOTSEC_PART_OFFSET, - (char *) SCRATCHADDR + BOOTSEC_PART_OFFSET, - BOOTSEC_PART_LENGTH); + /* Need only the partition table. + XXX: We cannot use grub_memmove because BOOT_PART_TABLE + (0x07be) is less than 0x1000. */ + dst = (char *) BOOT_PART_TABLE; + src = (char *) SCRATCHADDR + BOOTSEC_PART_OFFSET; + while (dst < (char *) BOOT_PART_TABLE + BOOTSEC_PART_LENGTH) + *dst++ = *src++; } chain_stage1 (0, BOOTSEC_LOCATION, boot_part_addr); diff --git a/stage2/disk_io.c b/stage2/disk_io.c index b4fb29d6d..3e39ff2e8 100644 --- a/stage2/disk_io.c +++ b/stage2/disk_io.c @@ -485,7 +485,7 @@ check_BSD_parts (int flags) if (flags) { if (! do_completion) - grub_printf (" No BSD slice found, partition type 0x%x\n", + grub_printf (" No BSD sub-partition found, partition type 0x%x\n", current_slice); } #endif @@ -571,7 +571,7 @@ real_open_partition (int flags) part_length = PC_SLICE_LENGTH (mbr_buf, i); #ifndef STAGE1_5 cur_part_offset = part_offset; - cur_part_addr = BOOTSEC_LOCATION + PC_SLICE_OFFSET + (i << 4); + cur_part_addr = BOOT_PART_TABLE + (i << 4); #endif /* diff --git a/stage2/shared.h b/stage2/shared.h index 971d01e5c..f93d3ac5d 100644 --- a/stage2/shared.h +++ b/stage2/shared.h @@ -69,6 +69,8 @@ extern char *grub_scratch_mem; #define BUFFERADDR RAW_ADDR (0x70000) #define BUFFERSEG RAW_SEG (0x7000) +#define BOOT_PART_TABLE RAW_ADDR (0x07be) + /* * BIOS disk defines */ @@ -557,9 +559,11 @@ extern unsigned short ascii_key_map[]; extern unsigned short io_map[]; /* calls for direct boot-loader chaining */ -void chain_stage1 (int segment, int offset, int part_table_addr) +void chain_stage1 (unsigned long segment, unsigned long offset, + unsigned long part_table_addr) + __attribute__ ((noreturn)); +void chain_stage2 (unsigned long segment, unsigned long offset) __attribute__ ((noreturn)); -void chain_stage2 (int segment, int offset) __attribute__ ((noreturn)); /* do some funky stuff, then boot linux */ void linux_boot (void) __attribute__ ((noreturn));