[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ppc patch] setjmp/longjmp
From: |
Hollis Blanchard |
Subject: |
[ppc patch] setjmp/longjmp |
Date: |
Mon, 15 Nov 2004 22:56:36 -0600 |
User-agent: |
Mutt/1.5.6+20040722i |
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 <address@hidden>
* 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
- [ppc patch] setjmp/longjmp,
Hollis Blanchard <=