From 5270cec8d7aa16d5ff28431c4efdad5554536904 Mon Sep 17 00:00:00 2001 From: robertmh Date: Wed, 1 Apr 2009 13:01:05 +0000 Subject: [PATCH] 2009-04-01 David S. Miller * normal/sparc64/setjmp.S: Fix setjmp implementation. * include/grub/sparc64/setjmp.h (grub_jmp_buf): Update. (grub_setjmp): Mark with 'returns_twice' attribute. * include/grub/i386/setjmp.h (grub_setjmp): Likewise * include/grub/powerpc/setjmp.h (grub_setjmp): Likewise. * include/grub/x86_64/setjmp.h (grub_setjmp): Likewise. --- ChangeLog | 9 +++++++++ include/grub/i386/setjmp.h | 5 +++-- include/grub/powerpc/setjmp.h | 4 ++-- include/grub/sparc64/setjmp.h | 9 +++++---- include/grub/x86_64/setjmp.h | 4 ++-- normal/sparc64/setjmp.S | 21 +++++++++++++++------ 6 files changed, 36 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index cfd60707d..469968176 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-04-01 David S. Miller + + * normal/sparc64/setjmp.S: Fix setjmp implementation. + * include/grub/sparc64/setjmp.h (grub_jmp_buf): Update. + (grub_setjmp): Mark with 'returns_twice' attribute. + * include/grub/i386/setjmp.h (grub_setjmp): Likewise + * include/grub/powerpc/setjmp.h (grub_setjmp): Likewise. + * include/grub/x86_64/setjmp.h (grub_setjmp): Likewise. + 2009-04-01 Robert Millan Reapply fix from 2008-07-28 which was accidentally reverted; also diff --git a/include/grub/i386/setjmp.h b/include/grub/i386/setjmp.h index 02b0d8fe0..c5f94b406 100644 --- a/include/grub/i386/setjmp.h +++ b/include/grub/i386/setjmp.h @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2003,2006,2007 Free Software Foundation, Inc. + * Copyright (C) 2003,2006,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,7 +21,8 @@ typedef unsigned long grub_jmp_buf[6]; -int grub_setjmp (grub_jmp_buf env) __attribute__ ((cdecl, regparm (3))); +int grub_setjmp (grub_jmp_buf env) __attribute__ ((returns_twice, cdecl, + regparm (3))); void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn, cdecl, regparm (3))); diff --git a/include/grub/powerpc/setjmp.h b/include/grub/powerpc/setjmp.h index 441e53883..fa16f73d2 100644 --- a/include/grub/powerpc/setjmp.h +++ b/include/grub/powerpc/setjmp.h @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2004,2006,2007 Free Software Foundation, Inc. + * Copyright (C) 2002,2004,2006,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,7 +21,7 @@ typedef unsigned long grub_jmp_buf[20]; -int grub_setjmp (grub_jmp_buf env); +int grub_setjmp (grub_jmp_buf env) __attribute__ ((returns_twice)); void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn)); #endif /* ! GRUB_SETJMP_CPU_HEADER */ diff --git a/include/grub/sparc64/setjmp.h b/include/grub/sparc64/setjmp.h index 12d8e015f..6096baef1 100644 --- a/include/grub/sparc64/setjmp.h +++ b/include/grub/sparc64/setjmp.h @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2004,2006,2007 Free Software Foundation, Inc. + * Copyright (C) 2002,2004,2006,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,10 +19,11 @@ #ifndef GRUB_SETJMP_CPU_HEADER #define GRUB_SETJMP_CPU_HEADER 1 -/* FIXME (sparc64). */ -typedef unsigned long grub_jmp_buf[20]; +#include -int grub_setjmp (grub_jmp_buf env); +typedef grub_uint64_t grub_jmp_buf[3]; + +int grub_setjmp (grub_jmp_buf env) __attribute__ ((returns_twice)); void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn)); #endif /* ! GRUB_SETJMP_CPU_HEADER */ diff --git a/include/grub/x86_64/setjmp.h b/include/grub/x86_64/setjmp.h index e417f65b7..4ad968ed5 100644 --- a/include/grub/x86_64/setjmp.h +++ b/include/grub/x86_64/setjmp.h @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2003,2006,2007 Free Software Foundation, Inc. + * Copyright (C) 2003,2006,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,7 +21,7 @@ typedef unsigned long grub_jmp_buf[8]; -int grub_setjmp (grub_jmp_buf env); +int grub_setjmp (grub_jmp_buf env) __attribute__ ((returns_twice)); void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn)); #endif /* ! GRUB_SETJMP_CPU_HEADER */ diff --git a/normal/sparc64/setjmp.S b/normal/sparc64/setjmp.S index b1a9b6eef..0e23ecfa1 100644 --- a/normal/sparc64/setjmp.S +++ b/normal/sparc64/setjmp.S @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2005,2007 Free Software Foundation, Inc. + * Copyright (C) 2005,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,13 +26,22 @@ * int grub_setjmp (grub_jmp_buf env) */ FUNCTION(grub_setjmp) - ret - nop + stx %o7, [%o0 + 0x00] + stx %sp, [%o0 + 0x08] + stx %fp, [%o0 + 0x10] + retl + clr %o0 /* * int grub_longjmp (grub_jmp_buf env, int val) */ FUNCTION(grub_longjmp) - ret - nop - + ldx [%o0 + 0x10], %g1 + movrz %o1, 1, %o1 + flushw + ldx [%o0 + 0x00], %o7 + ldx [%o0 + 0x08], %fp + sub %fp, 192, %sp + stx %g1, [%sp + 2047 + (14 * 8)] + retl + restore %o1, 0, %o0