All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: 2.6.22-rc1-mm1: boot failure under qemu
Date: Wed, 16 May 2007 12:07:11 -0700	[thread overview]
Message-ID: <464B565F.3060900@zytor.com> (raw)
In-Reply-To: <464B4C68.6080804@goop.org>

[-- Attachment #1: Type: text/plain, Size: 473 bytes --]

Jeremy Fitzhardinge wrote:
> H. Peter Anvin wrote:
>> Okay, I've established that this is a bug in the Qemu kernel loader: the
>> Qemu loader puts zero in the loadflags, which is wrong no matter how you
>> slice it.
>>
>> I have checked in a workaround in the git.newsetup tree; the workaround
>> is to rely on a compile-time value for load low/load high instead of
>> looking at loadflags.
>>   
> 
> Can you post a patch to try?
> 

Cumulative diff from -rc1-mm1.

	-hpa

[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 2264 bytes --]

diff --git a/arch/i386/boot/Makefile b/arch/i386/boot/Makefile
index 6792d09..a2b3f93 100644
--- a/arch/i386/boot/Makefile
+++ b/arch/i386/boot/Makefile
@@ -62,6 +62,7 @@ AFLAGS		:= $(CFLAGS) -D__ASSEMBLY__
 $(obj)/zImage:  IMAGE_OFFSET := 0x1000
 $(obj)/zImage:  EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK)
 $(obj)/bzImage: IMAGE_OFFSET := 0x100000
+$(obj)/bzImage: EXTRA_CFLAGS := -D__BIG_KERNEL__
 $(obj)/bzImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__
 $(obj)/bzImage: BUILDFLAGS   := -b
 
diff --git a/arch/i386/boot/main.c b/arch/i386/boot/main.c
index 5f4d99d..873c777 100644
--- a/arch/i386/boot/main.c
+++ b/arch/i386/boot/main.c
@@ -112,6 +112,10 @@ void main(void)
 	if (boot_params.hdr.loadflags & CAN_USE_HEAP) {
 		heap_end = (char *)(boot_params.hdr.heap_end_ptr
 				    +0x200-STACK_SIZE);
+	} else {
+		/* Boot protocol 2.00 only, no heap available */
+		puts("WARNING: Ancient bootloader, some functionality "
+		     "may be limited!\n");
 	}
 
 	/* Make sure we have all the proper CPU support */
diff --git a/arch/i386/boot/memory.c b/arch/i386/boot/memory.c
index 8a82aa9..d7b250b 100644
--- a/arch/i386/boot/memory.c
+++ b/arch/i386/boot/memory.c
@@ -30,7 +30,7 @@ static int detect_memory_e820(void)
 		size = sizeof(struct e820entry);
 		id = SMAP;
 		asm("int $0x15; setc %0"
-		    : "=dm" (err), "+b" (next), "+d" (id), "+c" (size),
+		    : "=am" (err), "+b" (next), "+d" (id), "+c" (size),
 		      "=m" (*desc)
 		    : "D" (desc), "a" (0xe820));
 
diff --git a/arch/i386/boot/pm.c b/arch/i386/boot/pm.c
index 1c586f1..7af65f9 100644
--- a/arch/i386/boot/pm.c
+++ b/arch/i386/boot/pm.c
@@ -41,12 +41,13 @@ static void realmode_switch_hook(void)
  */
 static void move_kernel_around(void)
 {
+	/* Note: rely on the compile-time option here rather than
+	   the LOADED_HIGH flag.  The Qemu kernel loader unconditionally
+	   sets the loadflags to zero. */
+#ifndef __BIG_KERNEL__
 	u16 dst_seg, src_seg;
 	u32 syssize;
 
-	if (boot_params.hdr.loadflags & LOADED_HIGH)
-		return;
-
 	dst_seg =  0x1000 >> 4;
 	src_seg = 0x10000 >> 4;
 	syssize = boot_params.hdr.syssize; /* Size in 16-byte paragraps */
@@ -72,6 +73,7 @@ static void move_kernel_around(void)
 		dst_seg += paras;
 		src_seg += paras;
 	}
+#endif
 }
 
 /*

  parent reply	other threads:[~2007-05-16 19:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-16  8:23 2.6.22-rc1-mm1: boot failure under qemu Jeremy Fitzhardinge
2007-05-16 15:46 ` H. Peter Anvin
2007-05-16 16:30   ` Jeremy Fitzhardinge
2007-05-16 17:59     ` H. Peter Anvin
2007-05-16 18:24       ` Jeremy Fitzhardinge
2007-05-16 18:52         ` Nish Aravamudan
2007-05-16 19:07         ` H. Peter Anvin [this message]
2007-05-17  0:47           ` Jeremy Fitzhardinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=464B565F.3060900@zytor.com \
    --to=hpa@zytor.com \
    --cc=akpm@linux-foundation.org \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.