On Wed, Mar 18, 2009 at 7:55 PM, Kevin O'Connor <[email protected]> wrote:
> On Thu, Mar 19, 2009 at 01:49:23AM +0100, Stefan Reinauer wrote:
>> Kevin O'Connor wrote:
>> > On Wed, Mar 18, 2009 at 02:17:57PM -0600, Myles Watson wrote:
>> >
>> >> I think the breakage is occurring before the payload executes, but I'm
>> >> not sure of that.
>> >>
>> >> qemu: fatal: Trying to execute code outside RAM or ROM at 0xf10002ba
>> >>
>> >
>> > The bug is in src/arch/i386/boot/boot.c.  The inline assembly in
>> > jmp_to_elf_entry uses the "g" flag to pass in parameters.  However,
>> > "g" allows gcc to use stack relative addressing of parameters.
>> >
>>
>> Does it? I could not find that in the GCC Inline Assembly FAQ.
>
> Somewhere it says it can be an offsettable memory address.
>
>> Would changing the parameters to "m" solve the problem?
>
> I don't think so.  Easiest fix would be to change "g" to "ri" - put
> the parameter either in a register or as an immediate value.

That fixes it for me.  Patch attached.

Signed-off-by: Myles Watson <[email protected]>

Thanks,
Myles
Index: svn/src/arch/i386/boot/boot.c
===================================================================
--- svn.orig/src/arch/i386/boot/boot.c	2009-03-19 15:16:22.000000000 -0600
+++ svn/src/arch/i386/boot/boot.c	2009-03-19 15:18:21.000000000 -0600
@@ -175,12 +175,12 @@
 		"	popl	%%esi\n\t"
 
 		:: 
-		"g" (lb_start), "g" (buffer), "g" (lb_size),
-		"g" (entry),
+		"ri" (lb_start), "ri" (buffer), "ri" (lb_size),
+		"ri" (entry),
 #if CONFIG_MULTIBOOT
-		"g"(mbi), "g" (MB_MAGIC2)
+		"ri"(mbi), "ri" (MB_MAGIC2)
 #else
-		"g"(adjusted_boot_notes), "g" (0x0E1FB007)
+		"ri"(adjusted_boot_notes), "ri" (0x0E1FB007)
 #endif
 		);
 }
-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to