[PATCH 3/9] Conform more closely to Documentation/i386/boot.txt for bzImages.

Jamey Sharp jamey at thetovacompany.com
Tue Apr 22 19:21:06 EDT 2008


DS, ES, FS, and GS were all initialized to 0, but according to boot.txt
they need to point to setup_base. Recent kernel versions apparently rely
on this point of the spec, though earlier versions didn't.

Signed-off-by: Jamey Sharp <jamey at thetovacompany.com>
---
This patch is arguably incomplete, since SS and SP are also not being
set as specified by boot.txt. However, it seems that nobody cares at
present, and I had other issues I wanted to address.

 kexec/arch/i386/kexec-bzImage.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/kexec/arch/i386/kexec-bzImage.c b/kexec/arch/i386/kexec-bzImage.c
index 93e37a4..abb094c 100644
--- a/kexec/arch/i386/kexec-bzImage.c
+++ b/kexec/arch/i386/kexec-bzImage.c
@@ -284,9 +284,12 @@ int do_bzImage_load(struct kexec_info *info,
 	/*
 	 * Initialize the 16bit start information.
 	 */
-	regs16.cs = (setup_base>>4) + 0x20;
+	regs16.ds = regs16.es = regs16.fs = regs16.gs = setup_base >> 4;
+	regs16.cs = regs16.ds + 0x20;
 	regs16.ip = 0;
+	/* XXX: Documentation/i386/boot.txt says 'ss' must equal 'ds' */
 	regs16.ss = (elf_rel_get_addr(&info->rhdr, "stack_end") - 64*1024) >> 4;
+	/* XXX: Documentation/i386/boot.txt says 'sp' must equal heap_end */
 	regs16.esp = 0xFFFC;
 	if (real_mode_entry) {
 		printf("Starting the kernel in real mode\n");
-- 
1.5.4.1




More information about the kexec mailing list