[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help with powerpc asm (moving grub_ieee1275_entry_fn initialization
From: |
Pavel Roskin |
Subject: |
Re: help with powerpc asm (moving grub_ieee1275_entry_fn initialization to crt0.S) |
Date: |
Thu, 17 Jan 2008 02:54:33 -0500 |
User-agent: |
Internet Messaging Program (IMP) H3 (4.1.4) |
Quoting Robert Millan <address@hidden>:
Here's an incomplete (missing powerpc & sparc) version of the patch that
would sanitize this function call.
I don't see why it needs to be done across the board. Maybe you have
further simplifications in mind? Anyway, it's a good idea not to rely
on C calling conventions on any platform.
Here's the patch for PowerPC. It has been tested both in qemu and on
real hardware. I have verified that the value of
grub_ieee1275_entry_fn doesn't change.
By the way, please don't remove the declaration of cmain(). It may be
useful to prevent a gcc warning (missing declaration). cmain() is
really an rare case that doesn't need a declaration, since it's not
called by any C code, but gcc doesn't know that.
ChangeLog:
* kern/powerpc/ieee1275/cmain.c (cmain): Don't take any arguments.
* kern/powerpc/ieee1275/crt0.S: Store r5 in grub_ieee1275_entry_fn,
don't rely on cmain() doing it.
diff --git a/kern/powerpc/ieee1275/cmain.c b/kern/powerpc/ieee1275/cmain.c
index 5d4b0de..30dfe1c 100644
--- a/kern/powerpc/ieee1275/cmain.c
+++ b/kern/powerpc/ieee1275/cmain.c
@@ -114,12 +114,10 @@ grub_ieee1275_find_options (void)
}
}
-void cmain (uint32_t r3, uint32_t r4, uint32_t r5);
+void cmain (void);
void
-cmain (UNUSED uint32_t r3, UNUSED uint32_t r4, uint32_t r5)
+cmain (void)
{
- grub_ieee1275_entry_fn = (int (*)(void *)) r5;
-
grub_ieee1275_finddevice ("/chosen", &grub_ieee1275_chosen);
grub_ieee1275_find_options ();
diff --git a/kern/powerpc/ieee1275/crt0.S b/kern/powerpc/ieee1275/crt0.S
index f295dea..f6545fb 100644
--- a/kern/powerpc/ieee1275/crt0.S
+++ b/kern/powerpc/ieee1275/crt0.S
@@ -38,5 +38,9 @@ _start:
2: stwu 2, 4(6) /* We know r2 is already 0 from above. */
bdnz 2b
+ /* Store r5 in grub_ieee1275_entry_fn */
+ lis 9, address@hidden
+ stw 5, address@hidden(9)
+
bl cmain
1: b 1b
--
Regards,
Pavel Roskin
- help with powerpc asm (moving grub_ieee1275_entry_fn initialization to crt0.S), Robert Millan, 2008/01/13
- Re: help with powerpc asm (moving grub_ieee1275_entry_fn initialization to crt0.S), Robert Millan, 2008/01/15
- Re: help with powerpc asm (moving grub_ieee1275_entry_fn initialization to crt0.S),
Pavel Roskin <=
- Re: help with powerpc asm (moving grub_ieee1275_entry_fn initialization to crt0.S), Robert Millan, 2008/01/17
- Re: help with powerpc asm (moving grub_ieee1275_entry_fn initialization to crt0.S), Pavel Roskin, 2008/01/17
- Re: help with powerpc asm (moving grub_ieee1275_entry_fn initialization to crt0.S), Robert Millan, 2008/01/17
- Re: help with powerpc asm (moving grub_ieee1275_entry_fn initialization to crt0.S), Pavel Roskin, 2008/01/17
- Re: help with powerpc asm (moving grub_ieee1275_entry_fn initialization to crt0.S), Robert Millan, 2008/01/19