* [ppc patch] setjmp/longjmp
@ 2004-11-16 4:56 Hollis Blanchard
2004-11-16 10:01 ` Marco Gerards
2004-11-16 23:34 ` Marco Gerards
0 siblings, 2 replies; 7+ messages in thread
From: Hollis Blanchard @ 2004-11-16 4:56 UTC (permalink / raw)
To: grub-devel
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 <hollis@penguinppc.org>
* 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
diff -u -p -r1.7 init.c
--- kern/powerpc/ieee1275/init.c 15 Oct 2004 02:29:11 -0000 1.7
+++ kern/powerpc/ieee1275/init.c 16 Nov 2004 04:53:32 -0000
@@ -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
diff -u -p -r1.2 setjmp.h
--- include/grub/powerpc/setjmp.h 4 Apr 2004 13:46:01 -0000 1.2
+++ include/grub/powerpc/setjmp.h 16 Nov 2004 04:53:32 -0000
@@ -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
diff -N normal/powerpc/setjmp.S
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ normal/powerpc/setjmp.S 16 Nov 2004 04:53:32 -0000
@@ -0,0 +1,85 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <grub/symbol.h>
+
+ .file "setjmp.S"
+
+ .text
+
+/*
+ * int grub_setjmp (grub_jmp_buf env)
+ */
+FUNCTION(grub_setjmp)
+ stw 1, 0(3)
+ stw 14, 4(3)
+ stw 15, 8(3)
+ stw 16, 12(3)
+ stw 17, 16(3)
+ stw 18, 20(3)
+ stw 19, 24(3)
+ stw 20, 28(3)
+ stw 21, 32(3)
+ stw 22, 36(3)
+ stw 23, 40(3)
+ stw 24, 44(3)
+ stw 25, 48(3)
+ stw 26, 52(3)
+ stw 27, 56(3)
+ stw 28, 60(3)
+ stw 29, 64(3)
+ stw 30, 68(3)
+ mflr 4
+ stw 4, 72(3)
+ mfcr 4
+ stw 4, 76(3)
+ li 3, 0
+ blr
+
+/*
+ * int grub_longjmp (grub_jmp_buf env, int val)
+ */
+FUNCTION(grub_longjmp)
+ lwz 1, 0(3)
+ lwz 14, 4(3)
+ lwz 15, 8(3)
+ lwz 16, 12(3)
+ lwz 17, 16(3)
+ lwz 18, 20(3)
+ lwz 19, 24(3)
+ lwz 20, 28(3)
+ lwz 21, 32(3)
+ lwz 22, 36(3)
+ lwz 23, 40(3)
+ lwz 24, 44(3)
+ lwz 25, 48(3)
+ lwz 26, 52(3)
+ lwz 27, 56(3)
+ lwz 28, 60(3)
+ lwz 29, 64(3)
+ lwz 30, 68(3)
+ lwz 5, 72(3)
+ mtlr 5
+ lwz 5, 76(3)
+ mtcr 5
+ mr. 3, 4
+ bne 1f
+ li 3, 1
+1: blr
+
Index: conf/powerpc-ieee1275.rmk
===================================================================
RCS file: /cvsroot/grub/grub2/conf/powerpc-ieee1275.rmk,v
retrieving revision 1.13
diff -u -p -r1.13 powerpc-ieee1275.rmk
--- conf/powerpc-ieee1275.rmk 3 Nov 2004 03:21:14 -0000 1.13
+++ conf/powerpc-ieee1275.rmk 16 Nov 2004 04:58:32 -0000
@@ -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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ppc patch] setjmp/longjmp
2004-11-16 4:56 [ppc patch] setjmp/longjmp Hollis Blanchard
@ 2004-11-16 10:01 ` Marco Gerards
2004-11-16 16:04 ` Hollis Blanchard
2004-11-16 23:34 ` Marco Gerards
1 sibling, 1 reply; 7+ messages in thread
From: Marco Gerards @ 2004-11-16 10:01 UTC (permalink / raw)
To: The development of GRUB 2
Hollis Blanchard <hollis@penguinppc.org> writes:
> 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).
Nice. This evening I will try to fix that -DGRUB_UTIL thing and test
this code of yours.
> * 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.
> Index: conf/powerpc-ieee1275.rmk
...
> + normal/powerpc/setjmp.S \
I don't see this change in your changelog entry.
Thanks,
Marco
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ppc patch] setjmp/longjmp
2004-11-16 10:01 ` Marco Gerards
@ 2004-11-16 16:04 ` Hollis Blanchard
2004-11-16 16:47 ` Marco Gerards
0 siblings, 1 reply; 7+ messages in thread
From: Hollis Blanchard @ 2004-11-16 16:04 UTC (permalink / raw)
To: The development of GRUB 2
On Nov 16, 2004, at 4:01 AM, Marco Gerards wrote:
>
>> * 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.
>> Index: conf/powerpc-ieee1275.rmk
> ...
>> + 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ppc patch] setjmp/longjmp
2004-11-16 16:04 ` Hollis Blanchard
@ 2004-11-16 16:47 ` Marco Gerards
0 siblings, 0 replies; 7+ messages in thread
From: Marco Gerards @ 2004-11-16 16:47 UTC (permalink / raw)
To: The development of GRUB 2
Hollis Blanchard <hollis@penguinppc.org> writes:
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ppc patch] setjmp/longjmp
2004-11-16 4:56 [ppc patch] setjmp/longjmp Hollis Blanchard
2004-11-16 10:01 ` Marco Gerards
@ 2004-11-16 23:34 ` Marco Gerards
2004-11-17 10:11 ` Yoshinori K. Okuji
1 sibling, 1 reply; 7+ messages in thread
From: Marco Gerards @ 2004-11-16 23:34 UTC (permalink / raw)
To: The development of GRUB 2
Hollis Blanchard <hollis@penguinppc.org> writes:
> 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...
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ppc patch] setjmp/longjmp
2004-11-16 23:34 ` Marco Gerards
@ 2004-11-17 10:11 ` Yoshinori K. Okuji
2004-11-17 15:20 ` Marco Gerards
0 siblings, 1 reply; 7+ messages in thread
From: Yoshinori K. Okuji @ 2004-11-17 10:11 UTC (permalink / raw)
To: The development of GRUB 2
On Wednesday 17 November 2004 00:34, Marco Gerards wrote:
> 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.
Ugghaa, very dirty. Please remove such a macro as soon as possible.
Okuji
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ppc patch] setjmp/longjmp
2004-11-17 10:11 ` Yoshinori K. Okuji
@ 2004-11-17 15:20 ` Marco Gerards
0 siblings, 0 replies; 7+ messages in thread
From: Marco Gerards @ 2004-11-17 15:20 UTC (permalink / raw)
To: The development of GRUB 2
"Yoshinori K. Okuji" <okuji@enbug.org> writes:
> On Wednesday 17 November 2004 00:34, Marco Gerards wrote:
>> 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.
>
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-11-17 15:43 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-16 4:56 [ppc patch] setjmp/longjmp Hollis Blanchard
2004-11-16 10:01 ` Marco Gerards
2004-11-16 16:04 ` Hollis Blanchard
2004-11-16 16:47 ` Marco Gerards
2004-11-16 23:34 ` Marco Gerards
2004-11-17 10:11 ` Yoshinori K. Okuji
2004-11-17 15:20 ` Marco Gerards
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.