diff --git a/ChangeLog b/ChangeLog index 692ebb2da..c0e93ea2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2004-11-17 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: New file. + * conf/powerpc-ieee1275.rmk (grubof_SOURCES): Add + `normal/powerpc/setjmp.S'. + (grubof_CFLAGS): Add `-DGRUBOF'. + * include/grub/setjmp.h [GRUB_UTIL]: Changed condition to + [GRUB_UTIL && !GRUBOF]. + 2004-11-16 Marco Gerards * kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): Skip any diff --git a/conf/powerpc-ieee1275.mk b/conf/powerpc-ieee1275.mk index 9dd6d5c92..c5649d09c 100644 --- a/conf/powerpc-ieee1275.mk +++ b/conf/powerpc-ieee1275.mk @@ -337,11 +337,12 @@ grubof_SOURCES = boot/powerpc/ieee1275/crt0.S boot/powerpc/ieee1275/cmain.c \ fs/jfs.c normal/cmdline.c normal/command.c normal/main.c normal/menu.c \ 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 -CLEANFILES += grubof grubof-boot_powerpc_ieee1275_crt0.o grubof-boot_powerpc_ieee1275_cmain.o grubof-boot_powerpc_ieee1275_ieee1275.o grubof-kern_main.o grubof-kern_device.o grubof-kern_disk.o grubof-kern_dl.o grubof-kern_file.o grubof-kern_fs.o grubof-kern_err.o grubof-fs_fshelp.o grubof-kern_misc.o grubof-kern_mm.o grubof-kern_loader.o grubof-kern_rescue.o grubof-kern_term.o grubof-kern_powerpc_ieee1275_init.o grubof-term_powerpc_ieee1275_ofconsole.o grubof-kern_powerpc_ieee1275_openfw.o grubof-fs_ext2.o grubof-fs_ufs.o grubof-fs_minix.o grubof-fs_hfs.o grubof-fs_jfs.o grubof-normal_cmdline.o grubof-normal_command.o grubof-normal_main.o grubof-normal_menu.o grubof-disk_powerpc_ieee1275_ofdisk.o grubof-disk_powerpc_ieee1275_partition.o grubof-kern_env.o grubof-normal_arg.o grubof-loader_powerpc_ieee1275_linux.o grubof-loader_powerpc_ieee1275_linux_normal.o grubof-commands_boot.o -MOSTLYCLEANFILES += grubof-boot_powerpc_ieee1275_crt0.d grubof-boot_powerpc_ieee1275_cmain.d grubof-boot_powerpc_ieee1275_ieee1275.d grubof-kern_main.d grubof-kern_device.d grubof-kern_disk.d grubof-kern_dl.d grubof-kern_file.d grubof-kern_fs.d grubof-kern_err.d grubof-fs_fshelp.d grubof-kern_misc.d grubof-kern_mm.d grubof-kern_loader.d grubof-kern_rescue.d grubof-kern_term.d grubof-kern_powerpc_ieee1275_init.d grubof-term_powerpc_ieee1275_ofconsole.d grubof-kern_powerpc_ieee1275_openfw.d grubof-fs_ext2.d grubof-fs_ufs.d grubof-fs_minix.d grubof-fs_hfs.d grubof-fs_jfs.d grubof-normal_cmdline.d grubof-normal_command.d grubof-normal_main.d grubof-normal_menu.d grubof-disk_powerpc_ieee1275_ofdisk.d grubof-disk_powerpc_ieee1275_partition.d grubof-kern_env.d grubof-normal_arg.d grubof-loader_powerpc_ieee1275_linux.d grubof-loader_powerpc_ieee1275_linux_normal.d grubof-commands_boot.d + loader/powerpc/ieee1275/linux_normal.c commands/boot.c \ + normal/powerpc/setjmp.S +CLEANFILES += grubof grubof-boot_powerpc_ieee1275_crt0.o grubof-boot_powerpc_ieee1275_cmain.o grubof-boot_powerpc_ieee1275_ieee1275.o grubof-kern_main.o grubof-kern_device.o grubof-kern_disk.o grubof-kern_dl.o grubof-kern_file.o grubof-kern_fs.o grubof-kern_err.o grubof-fs_fshelp.o grubof-kern_misc.o grubof-kern_mm.o grubof-kern_loader.o grubof-kern_rescue.o grubof-kern_term.o grubof-kern_powerpc_ieee1275_init.o grubof-term_powerpc_ieee1275_ofconsole.o grubof-kern_powerpc_ieee1275_openfw.o grubof-fs_ext2.o grubof-fs_ufs.o grubof-fs_minix.o grubof-fs_hfs.o grubof-fs_jfs.o grubof-normal_cmdline.o grubof-normal_command.o grubof-normal_main.o grubof-normal_menu.o grubof-disk_powerpc_ieee1275_ofdisk.o grubof-disk_powerpc_ieee1275_partition.o grubof-kern_env.o grubof-normal_arg.o grubof-loader_powerpc_ieee1275_linux.o grubof-loader_powerpc_ieee1275_linux_normal.o grubof-commands_boot.o grubof-normal_powerpc_setjmp.o +MOSTLYCLEANFILES += grubof-boot_powerpc_ieee1275_crt0.d grubof-boot_powerpc_ieee1275_cmain.d grubof-boot_powerpc_ieee1275_ieee1275.d grubof-kern_main.d grubof-kern_device.d grubof-kern_disk.d grubof-kern_dl.d grubof-kern_file.d grubof-kern_fs.d grubof-kern_err.d grubof-fs_fshelp.d grubof-kern_misc.d grubof-kern_mm.d grubof-kern_loader.d grubof-kern_rescue.d grubof-kern_term.d grubof-kern_powerpc_ieee1275_init.d grubof-term_powerpc_ieee1275_ofconsole.d grubof-kern_powerpc_ieee1275_openfw.d grubof-fs_ext2.d grubof-fs_ufs.d grubof-fs_minix.d grubof-fs_hfs.d grubof-fs_jfs.d grubof-normal_cmdline.d grubof-normal_command.d grubof-normal_main.d grubof-normal_menu.d grubof-disk_powerpc_ieee1275_ofdisk.d grubof-disk_powerpc_ieee1275_partition.d grubof-kern_env.d grubof-normal_arg.d grubof-loader_powerpc_ieee1275_linux.d grubof-loader_powerpc_ieee1275_linux_normal.d grubof-commands_boot.d grubof-normal_powerpc_setjmp.d -grubof: grubof-boot_powerpc_ieee1275_crt0.o grubof-boot_powerpc_ieee1275_cmain.o grubof-boot_powerpc_ieee1275_ieee1275.o grubof-kern_main.o grubof-kern_device.o grubof-kern_disk.o grubof-kern_dl.o grubof-kern_file.o grubof-kern_fs.o grubof-kern_err.o grubof-fs_fshelp.o grubof-kern_misc.o grubof-kern_mm.o grubof-kern_loader.o grubof-kern_rescue.o grubof-kern_term.o grubof-kern_powerpc_ieee1275_init.o grubof-term_powerpc_ieee1275_ofconsole.o grubof-kern_powerpc_ieee1275_openfw.o grubof-fs_ext2.o grubof-fs_ufs.o grubof-fs_minix.o grubof-fs_hfs.o grubof-fs_jfs.o grubof-normal_cmdline.o grubof-normal_command.o grubof-normal_main.o grubof-normal_menu.o grubof-disk_powerpc_ieee1275_ofdisk.o grubof-disk_powerpc_ieee1275_partition.o grubof-kern_env.o grubof-normal_arg.o grubof-loader_powerpc_ieee1275_linux.o grubof-loader_powerpc_ieee1275_linux_normal.o grubof-commands_boot.o +grubof: grubof-boot_powerpc_ieee1275_crt0.o grubof-boot_powerpc_ieee1275_cmain.o grubof-boot_powerpc_ieee1275_ieee1275.o grubof-kern_main.o grubof-kern_device.o grubof-kern_disk.o grubof-kern_dl.o grubof-kern_file.o grubof-kern_fs.o grubof-kern_err.o grubof-fs_fshelp.o grubof-kern_misc.o grubof-kern_mm.o grubof-kern_loader.o grubof-kern_rescue.o grubof-kern_term.o grubof-kern_powerpc_ieee1275_init.o grubof-term_powerpc_ieee1275_ofconsole.o grubof-kern_powerpc_ieee1275_openfw.o grubof-fs_ext2.o grubof-fs_ufs.o grubof-fs_minix.o grubof-fs_hfs.o grubof-fs_jfs.o grubof-normal_cmdline.o grubof-normal_command.o grubof-normal_main.o grubof-normal_menu.o grubof-disk_powerpc_ieee1275_ofdisk.o grubof-disk_powerpc_ieee1275_partition.o grubof-kern_env.o grubof-normal_arg.o grubof-loader_powerpc_ieee1275_linux.o grubof-loader_powerpc_ieee1275_linux_normal.o grubof-commands_boot.o grubof-normal_powerpc_setjmp.o $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grubof_LDFLAGS) grubof-boot_powerpc_ieee1275_crt0.o: boot/powerpc/ieee1275/crt0.S @@ -624,8 +625,16 @@ grubof-commands_boot.d: commands/boot.c -include grubof-commands_boot.d +grubof-normal_powerpc_setjmp.o: normal/powerpc/setjmp.S + $(BUILD_CC) -Inormal/powerpc -I$(srcdir)/normal/powerpc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< + +grubof-normal_powerpc_setjmp.d: normal/powerpc/setjmp.S + set -e; $(BUILD_CC) -Inormal/powerpc -I$(srcdir)/normal/powerpc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,setjmp\.o[ :]*,grubof-normal_powerpc_setjmp.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include grubof-normal_powerpc_setjmp.d + grubof_HEADERS = grub/powerpc/ieee1275/ieee1275.h -grubof_CFLAGS = $(COMMON_CFLAGS) +grubof_CFLAGS = $(COMMON_CFLAGS) -DGRUBOF grubof_ASFLAGS = $(COMMON_ASFLAGS) grubof_LDFLAGS = -nostdlib -static-libgcc -lgcc -Wl,-N,-S,-Ttext,0x200000,-Bstatic diff --git a/conf/powerpc-ieee1275.rmk b/conf/powerpc-ieee1275.rmk index ae995c449..bcf00532c 100644 --- a/conf/powerpc-ieee1275.rmk +++ b/conf/powerpc-ieee1275.rmk @@ -43,9 +43,10 @@ grubof_SOURCES = boot/powerpc/ieee1275/crt0.S boot/powerpc/ieee1275/cmain.c \ fs/jfs.c normal/cmdline.c normal/command.c normal/main.c normal/menu.c \ 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 + loader/powerpc/ieee1275/linux_normal.c commands/boot.c \ + normal/powerpc/setjmp.S grubof_HEADERS = grub/powerpc/ieee1275/ieee1275.h -grubof_CFLAGS = $(COMMON_CFLAGS) +grubof_CFLAGS = $(COMMON_CFLAGS) -DGRUBOF grubof_ASFLAGS = $(COMMON_ASFLAGS) grubof_LDFLAGS = -nostdlib -static-libgcc -lgcc -Wl,-N,-S,-Ttext,0x200000,-Bstatic diff --git a/include/grub/powerpc/setjmp.h b/include/grub/powerpc/setjmp.h index 82fc272ab..13082a29a 100644 --- a/include/grub/powerpc/setjmp.h +++ b/include/grub/powerpc/setjmp.h @@ -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 */ diff --git a/include/grub/setjmp.h b/include/grub/setjmp.h index 698a5ded8..527b23822 100644 --- a/include/grub/setjmp.h +++ b/include/grub/setjmp.h @@ -20,7 +20,7 @@ #ifndef GRUB_SETJMP_HEADER #define GRUB_SETJMP_HEADER 1 -#ifdef GRUB_UTIL +#if defined(GRUB_UTIL) && !defined(GRUBOF) #include typedef jmp_buf grub_jmp_buf; #define grub_setjmp setjmp diff --git a/kern/powerpc/ieee1275/init.c b/kern/powerpc/ieee1275/init.c index 168bafb38..026888355 100644 --- a/kern/powerpc/ieee1275/init.c +++ b/kern/powerpc/ieee1275/init.c @@ -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))) -{ -} diff --git a/normal/powerpc/setjmp.S b/normal/powerpc/setjmp.S new file mode 100644 index 000000000..50d69d322 --- /dev/null +++ b/normal/powerpc/setjmp.S @@ -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 +