From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MQsrH-0002Nu-Pn for mharc-grub-devel@gnu.org; Tue, 14 Jul 2009 21:00:31 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MQsrF-0002M0-Nr for grub-devel@gnu.org; Tue, 14 Jul 2009 21:00:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MQsrB-0002FN-U4 for grub-devel@gnu.org; Tue, 14 Jul 2009 21:00:29 -0400 Received: from [199.232.76.173] (port=49999 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MQsrB-0002F6-HB for grub-devel@gnu.org; Tue, 14 Jul 2009 21:00:25 -0400 Received: from c60.cesmail.net ([216.154.195.49]:38773) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1MQsrA-0004s1-RJ for grub-devel@gnu.org; Tue, 14 Jul 2009 21:00:25 -0400 Received: from unknown (HELO smtprelay2.cesmail.net) ([192.168.1.112]) by c60.cesmail.net with ESMTP; 14 Jul 2009 21:00:18 -0400 Received: from mj.roinet.com (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by smtprelay2.cesmail.net (Postfix) with ESMTPSA id DF40634C6D for ; Tue, 14 Jul 2009 21:09:43 -0400 (EDT) To: grub-devel@gnu.org From: Pavel Roskin Date: Tue, 14 Jul 2009 21:00:17 -0400 Message-ID: <20090715010017.17865.58915.stgit@mj.roinet.com> User-Agent: StGit/0.15-rc1-4-g4ce8 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [PATCH 1/7] Make boot/i386/pc/boot.S safer to modify X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jul 2009 01:00:30 -0000 ChangeLog: * include/grub/i386/pc/boot.h: Sort all offsets. (GRUB_BOOT_MACHINE_KERNEL_ADDRESS): Remove, it's unused. (GRUB_BOOT_MACHINE_KERNEL_SEGMENT): Likewise. * boot/i386/pc/boot.S: Assert location of every offset listed in include/grub/i386/pc/boot.h. --- boot/i386/pc/boot.S | 8 +++++++- include/grub/i386/pc/boot.h | 10 ++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/boot/i386/pc/boot.S b/boot/i386/pc/boot.S index 8d8c27c..fb90947 100644 --- a/boot/i386/pc/boot.S +++ b/boot/i386/pc/boot.S @@ -65,6 +65,7 @@ start: * this area. */ + . = _start + GRUB_BOOT_MACHINE_BPB_START . = _start + 4 /* scratch space */ @@ -91,14 +92,19 @@ cylinder_start: * End of BIOS parameter block. */ + . = _start + GRUB_BOOT_MACHINE_VER_MAJ boot_version: .byte GRUB_BOOT_VERSION_MAJOR, GRUB_BOOT_VERSION_MINOR kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR kernel_segment: .word GRUB_BOOT_MACHINE_KERNEL_SEG + + . = _start + GRUB_BOOT_MACHINE_KERNEL_SECTOR kernel_sector: .long 1, 0 + + . = _start + GRUB_BOOT_MACHINE_BOOT_DRIVE boot_drive: .byte 0xff /* the disk to load kernel from */ /* 0xff means use the boot drive */ @@ -477,8 +483,8 @@ nt_magic: * sneaky, huh? */ -part_start: . = _start + GRUB_BOOT_MACHINE_PART_START +part_start: probe_values: .byte 36, 18, 15, 9, 0 diff --git a/include/grub/i386/pc/boot.h b/include/grub/i386/pc/boot.h index f35cb3a..221ed38 100644 --- a/include/grub/i386/pc/boot.h +++ b/include/grub/i386/pc/boot.h @@ -31,17 +31,11 @@ /* The offset of the major version. */ #define GRUB_BOOT_MACHINE_VER_MAJ 0x3e -/* The offset of BOOT_DRIVE. */ -#define GRUB_BOOT_MACHINE_BOOT_DRIVE 0x4c - -/* The offset of KERNEL_ADDRESS. */ -#define GRUB_BOOT_MACHINE_KERNEL_ADDRESS 0x40 - /* The offset of KERNEL_SECTOR. */ #define GRUB_BOOT_MACHINE_KERNEL_SECTOR 0x44 -/* The offset of KERNEL_SEGMENT. */ -#define GRUB_BOOT_MACHINE_KERNEL_SEGMENT 0x42 +/* The offset of BOOT_DRIVE. */ +#define GRUB_BOOT_MACHINE_BOOT_DRIVE 0x4c /* The offset of BOOT_DRIVE_CHECK. */ #define GRUB_BOOT_MACHINE_DRIVE_CHECK 0x4e