setjmp/longjmp
PATCH 1/1 setjmp/longjmp
I've implemented setjmp and longjmp for PowerPC. Annoyingly, because PPC still has no module support, files are compiled with -DGRUB_UTIL=1, and that causes include/grub/setjmp.h to redefine both functions. I guess that means we used to link in the libc setjmp/longjmp (which then failed miserably when one tried to run them).
Anyways, I have done some standalone tests and it seems to work fine. So pretending the GRUB_UTIL stuff is fixed, this wouldn't break the build...
-Hollis
2004-11-15 Hollis Blanchard <[email protected]>
* kern/powerpc/ieee1275/init.c (grub_setjmp): Remove function. (grub_longjmp): Likewise.
* include/grub/powerpc/setjmp.h (grub_jmp_buf): Set array size to 20.
* normal/powerpc/setjmp.S (grub_setjmp): New function. (grub_longjmp): Likewise.
Index: kern/powerpc/ieee1275/init.c
===================================================================
RCS file: /cvsroot/grub/grub2/kern/powerpc/ieee1275/init.c,v retrieving revision 1.7
powerpc/ieee1275/init.c +0 -12
@@ -111,15 +111,3 @@ grub_get_rtc (void) {return 0 ; } - -int -grub_setjmp (grub_jmp_buf env __attribute ((unused))) -{ -return 0 ; -} - -void -grub_longjmp (grub_jmp_buf env __attribute ((unused)), -int val __attribute ((unused))) -{ -}
Index: include/grub/powerpc/setjmp.h
===================================================================
RCS file: /cvsroot/grub/grub2/include/grub/powerpc/setjmp.h,v retrieving revision 1.2
grub/powerpc/setjmp.h +1 -1
@@ -20,6 +20,6 @@#ifndef GRUB_SETJMP_CPU_HEADER #define GRUB_SETJMP_CPU_HEADER 1 -typedef unsigned long grub_jmp_buf [6 ]; +typedef unsigned long grub_jmp_buf [20 ];#endif /* ! GRUB_SETJMP_CPU_HEADER */
Index: normal/powerpc/setjmp.S
===================================================================
RCS file: normal/powerpc/setjmp.S
powerpc/setjmp.S new file +85 -0
85 lines not on this page · raw message
Index: conf/powerpc-ieee1275.rmk
===================================================================
RCS file: /cvsroot/grub/grub2/conf/powerpc-ieee1275.rmk,v retrieving revision 1.13
powerpc-ieee1275.rmk +1 -0
@@ -41,6 +41,7 @@ grubof_SOURCES = boot/powerpc/ieee1275/c kern/powerpc/ieee1275/init.c term/powerpc/ieee1275/ofconsole.c \ kern/powerpc/ieee1275/openfw.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c \ fs/jfs.c normal/cmdline.c normal/command.c normal/main.c normal/menu.c \ + normal/powerpc/setjmp.S \ disk/powerpc/ieee1275/ofdisk.c disk/powerpc/ieee1275/partition.c \ kern/env.c normal/arg.c loader/powerpc/ieee1275/linux.c \ loader/powerpc/ieee1275/linux_normal.c commands/boot.c
Quoted 5 lines · Hollis Blanchard
I've implemented setjmp and longjmp for PowerPC. Annoyingly, because PPC still has no module support, files are compiled with -DGRUB_UTIL=1, and that causes
include/grub/setjmp.hto redefine both functions. I guess that means we used to link in the libc setjmp/longjmp (which then failed miserably when one tried to run them).
Nice. This evening I will try to fix that -DGRUB_UTIL thing and test this code of yours.
Quoted 2 lines
*
normal/powerpc/setjmp.S(grub_setjmp): New function. (grub_longjmp): Likewise.
You can better say:
* normal/powerpc/setjmp.S: New file.
When you make a new file and you did not move old code there saying it is a new file is sufficient.
Quoted 1 line
Index: conf/powerpc-ieee1275.rmk
...
powerpc-ieee1275.rmk grubof_SOURCES = boot/powerpc/ieee1275/c · line 44
Quoted 1 line
powerpc-ieee1275.rmk +1
-0+ normal/powerpc/setjmp.S \
I don't see this change in your changelog entry.
Thanks,
Marco
Quoted 10 lines · Marco Gerards
Quoted 3 lines
*
normal/powerpc/setjmp.S(grub_setjmp): New function. (grub_longjmp): Likewise.You can better say:
*
normal/powerpc/setjmp.S: New file.When you make a new file and you did not move old code there saying it is a new file is sufficient.
Ok.
Quoted 5 lines
Quoted 1 line
Index: conf/powerpc-ieee1275.rmk
...
powerpc-ieee1275.rmk grubof_SOURCES = boot/powerpc/ieee1275/c · line 44
Quoted 1 line
powerpc-ieee1275.rmk +1
-0+ normal/powerpc/setjmp.S \I don't see this change in your changelog entry.
Yeah, I wasn't even going to include that part of the patch originally since it breaks the build. Then I did, and forgot the changelog entry. Then I didn't bother to reply to myself, since I knew you'd do it for me. ;)
-Hollis
Quoted 4 lines · Hollis Blanchard
Yeah, I wasn't even going to include that part of the patch originally since it breaks the build. Then I did, and forgot the changelog entry. Then I didn't bother to reply to myself, since I knew you'd do it for me. ;)
LOL!
Don't worry. I will have a look at it and check in your patch myself including the required changes.
Feel free to bother me about this when I forget about it.
Thanks,
Marco
Quoted 3 lines · Hollis Blanchard
Anyways, I have done some standalone tests and it seems to work fine. So pretending the
GRUB_UTILstuff is fixed, this wouldn't break the build...
Thanks for your patch.
For now I have added a macro called "GRUBOF" which is defined for grubof. In include/grub/setjmp.h I made a change to make an exception for grubof. I did this because a lot of GRUB_UTILS things are still required for grubof.
This can all change when module loading is supported.
I just committed the patch and it works great. I've also committed another patch which fixes some problem I had on the pegasos.
Thanks,
Marco
Quoted 4 lines · Marco Gerards
For now I have added a macro called "GRUBOF" which is defined for grubof. In
include/grub/setjmp.hI made a change to make an exception for grubof. I did this because a lot ofGRUB_UTILSthings are still required for grubof.
Ugghaa, very dirty. Please remove such a macro as soon as possible.
Okuji
Quoted 7 lines · Yoshinori K. Okuji
Quoted 4 lines · Marco Gerards
For now I have added a macro called "GRUBOF" which is defined for grubof. In
include/grub/setjmp.hI made a change to make an exception for grubof. I did this because a lot ofGRUB_UTILSthings are still required for grubof.Ugghaa, very dirty. Please remove such a macro as soon as possible.
Yes, I agree. I will remove it as soon as module loading is possible on the PPC. It is one of my highest priorities.
Thanks,
Marco