From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.33) id 1CTviA-0001Gs-AR for mharc-grub-devel@gnu.org; Tue, 16 Nov 2004 00:17:02 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CTvi8-0001Gi-TJ for grub-devel@gnu.org; Tue, 16 Nov 2004 00:17:00 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CTvi8-0001GH-CS for grub-devel@gnu.org; Tue, 16 Nov 2004 00:17:00 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CTvi7-0001GE-ST for grub-devel@gnu.org; Tue, 16 Nov 2004 00:16:59 -0500 Received: from [207.217.121.253] (helo=pop-a065d19.pas.sa.earthlink.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CTvZM-0003O2-2o for grub-devel@gnu.org; Tue, 16 Nov 2004 00:07:56 -0500 Received: from user-0vvde2s.cable.mindspring.com ([63.246.184.92] helo=miracle) by pop-a065d19.pas.sa.earthlink.net with esmtp (Exim 3.33 #1) id 1CTvZL-0004aT-00 for grub-devel@gnu.org; Mon, 15 Nov 2004 21:07:55 -0800 Received: from hollis by miracle with local (Exim 3.36 #1 (Debian)) id 1CTvOO-00012R-00 for ; Mon, 15 Nov 2004 22:56:36 -0600 Date: Mon, 15 Nov 2004 22:56:36 -0600 To: grub-devel@gnu.org Message-ID: <20041116045636.GA3896@miracle> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.6+20040722i From: Hollis Blanchard Subject: [ppc patch] setjmp/longjmp X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Nov 2004 05:17:01 -0000 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 * 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 + + .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