* [PATCH]: grub: Fix sparc64 setjmp implementation, update grub_setjmp() attributes.
@ 2009-03-26 4:13 David Miller
2009-03-28 13:39 ` Robert Millan
0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2009-03-26 4:13 UTC (permalink / raw)
To: grub-devel
The FSF has received my copyright assignment paperwork so I'm starting
to feed fresh copies of my sparc64 changes.
Here, we fix the setjmp assembler implementation for sparc64 and also
we fix all of the grub_setjmp declarations to have the proper
"returns_twice" attribute.
For normal "setjmp" GCC recognizes this special function name and
internally adds the attribute. Amongst other things this makes sure
GCC does not emit a tail-call in functions that call grub_setjmp().
Since we use a special name for setjmp in GRUB we need to explicitly
add the attribute.
Without this fix, GCC on sparc64 really did emit a tail-call in the
nomal module where grub_setjmp() is called, and this led to myserious
crashes :-)
2009-03-25 David S. Miller <davem@davemloft.net>
* 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.
---
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 +++++++++++++++------
5 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/include/grub/i386/setjmp.h b/include/grub/i386/setjmp.h
index 02b0d8f..c5f94b4 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 441e538..fa16f73 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 12d8e01..6096bae 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 <grub/types.h>
-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 e417f65..4ad968e 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 b1a9b6e..0e23ecf 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
--
1.6.2.1.222.g570cc
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH]: grub: Fix sparc64 setjmp implementation, update grub_setjmp() attributes.
2009-03-26 4:13 [PATCH]: grub: Fix sparc64 setjmp implementation, update grub_setjmp() attributes David Miller
@ 2009-03-28 13:39 ` Robert Millan
2009-03-28 14:34 ` Yoshinori K. Okuji
0 siblings, 1 reply; 8+ messages in thread
From: Robert Millan @ 2009-03-28 13:39 UTC (permalink / raw)
To: The development of GRUB 2
On Wed, Mar 25, 2009 at 09:13:52PM -0700, David Miller wrote:
>
> The FSF has received my copyright assignment paperwork so I'm starting
> to feed fresh copies of my sparc64 changes.
>
> Here, we fix the setjmp assembler implementation for sparc64 and also
> we fix all of the grub_setjmp declarations to have the proper
> "returns_twice" attribute.
>
> For normal "setjmp" GCC recognizes this special function name and
> internally adds the attribute. Amongst other things this makes sure
> GCC does not emit a tail-call in functions that call grub_setjmp().
> Since we use a special name for setjmp in GRUB we need to explicitly
> add the attribute.
>
> Without this fix, GCC on sparc64 really did emit a tail-call in the
> nomal module where grub_setjmp() is called, and this led to myserious
> crashes :-)
>
> 2009-03-25 David S. Miller <davem@davemloft.net>
>
> * 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.
Hi,
Unless there's someone else in the list who is knowledgeable about sparc
assembly and is going to review this part of David's patch, I'm going to
assume it's fine and check it in.
This also goes for future patches sent by David. So if you will speak,
do it now :-)
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH]: grub: Fix sparc64 setjmp implementation, update grub_setjmp() attributes.
2009-03-28 13:39 ` Robert Millan
@ 2009-03-28 14:34 ` Yoshinori K. Okuji
2009-04-01 8:17 ` David Miller
0 siblings, 1 reply; 8+ messages in thread
From: Yoshinori K. Okuji @ 2009-03-28 14:34 UTC (permalink / raw)
To: The development of GRUB 2
On Saturday 28 March 2009 22:39:48 Robert Millan wrote:
> On Wed, Mar 25, 2009 at 09:13:52PM -0700, David Miller wrote:
> > The FSF has received my copyright assignment paperwork so I'm starting
> > to feed fresh copies of my sparc64 changes.
> >
> > Here, we fix the setjmp assembler implementation for sparc64 and also
> > we fix all of the grub_setjmp declarations to have the proper
> > "returns_twice" attribute.
> >
> > For normal "setjmp" GCC recognizes this special function name and
> > internally adds the attribute. Amongst other things this makes sure
> > GCC does not emit a tail-call in functions that call grub_setjmp().
> > Since we use a special name for setjmp in GRUB we need to explicitly
> > add the attribute.
> >
> > Without this fix, GCC on sparc64 really did emit a tail-call in the
> > nomal module where grub_setjmp() is called, and this led to myserious
> > crashes :-)
> >
> > 2009-03-25 David S. Miller <davem@davemloft.net>
> >
> > * 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.
>
> Hi,
>
> Unless there's someone else in the list who is knowledgeable about sparc
> assembly and is going to review this part of David's patch, I'm going to
> assume it's fine and check it in.
>
> This also goes for future patches sent by David. So if you will speak,
> do it now :-)
I know a bit, but not that much. So I vote for that we just trust him. ;)
Regards,
Okuji
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH]: grub: Fix sparc64 setjmp implementation, update grub_setjmp() attributes.
2009-03-28 14:34 ` Yoshinori K. Okuji
@ 2009-04-01 8:17 ` David Miller
2009-04-01 13:01 ` Robert Millan
0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2009-04-01 8:17 UTC (permalink / raw)
To: grub-devel, okuji
From: "Yoshinori K. Okuji" <okuji@enbug.org>
Date: Sat, 28 Mar 2009 23:34:25 +0900
> On Saturday 28 March 2009 22:39:48 Robert Millan wrote:
> > Unless there's someone else in the list who is knowledgeable about sparc
> > assembly and is going to review this part of David's patch, I'm going to
> > assume it's fine and check it in.
> >
> > This also goes for future patches sent by David. So if you will speak,
> > do it now :-)
>
> I know a bit, but not that much. So I vote for that we just trust him. ;)
Ping?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH]: grub: Fix sparc64 setjmp implementation, update grub_setjmp() attributes.
2009-04-01 8:17 ` David Miller
@ 2009-04-01 13:01 ` Robert Millan
2009-04-01 13:59 ` Yoshinori K. Okuji
2009-04-01 21:16 ` David Miller
0 siblings, 2 replies; 8+ messages in thread
From: Robert Millan @ 2009-04-01 13:01 UTC (permalink / raw)
To: The development of GRUB 2; +Cc: okuji
On Wed, Apr 01, 2009 at 01:17:40AM -0700, David Miller wrote:
> From: "Yoshinori K. Okuji" <okuji@enbug.org>
> Date: Sat, 28 Mar 2009 23:34:25 +0900
>
> > On Saturday 28 March 2009 22:39:48 Robert Millan wrote:
> > > Unless there's someone else in the list who is knowledgeable about sparc
> > > assembly and is going to review this part of David's patch, I'm going to
> > > assume it's fine and check it in.
> > >
> > > This also goes for future patches sent by David. So if you will speak,
> > > do it now :-)
> >
> > I know a bit, but not that much. So I vote for that we just trust him. ;)
>
> Ping?
Committed.
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH]: grub: Fix sparc64 setjmp implementation, update grub_setjmp() attributes.
2009-04-01 13:01 ` Robert Millan
@ 2009-04-01 13:59 ` Yoshinori K. Okuji
2009-04-01 21:16 ` David Miller
2009-04-01 21:16 ` David Miller
1 sibling, 1 reply; 8+ messages in thread
From: Yoshinori K. Okuji @ 2009-04-01 13:59 UTC (permalink / raw)
To: The development of GRUB 2
On Wednesday 01 April 2009 22:01:11 Robert Millan wrote:
> On Wed, Apr 01, 2009 at 01:17:40AM -0700, David Miller wrote:
> > From: "Yoshinori K. Okuji" <okuji@enbug.org>
> > Date: Sat, 28 Mar 2009 23:34:25 +0900
> >
> > > On Saturday 28 March 2009 22:39:48 Robert Millan wrote:
> > > > Unless there's someone else in the list who is knowledgeable about
> > > > sparc assembly and is going to review this part of David's patch, I'm
> > > > going to assume it's fine and check it in.
> > > >
> > > > This also goes for future patches sent by David. So if you will
> > > > speak, do it now :-)
> > >
> > > I know a bit, but not that much. So I vote for that we just trust him.
> > > ;)
> >
> > Ping?
>
> Committed.
David, I can give you a permission, if you tell me your account on Savannah.
Regards,
Okuji
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH]: grub: Fix sparc64 setjmp implementation, update grub_setjmp() attributes.
2009-04-01 13:59 ` Yoshinori K. Okuji
@ 2009-04-01 21:16 ` David Miller
0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2009-04-01 21:16 UTC (permalink / raw)
To: grub-devel, okuji
From: "Yoshinori K. Okuji" <okuji@enbug.org>
Date: Wed, 1 Apr 2009 22:59:03 +0900
> David, I can give you a permission, if you tell me your account on Savannah.
It is simply "davem"
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH]: grub: Fix sparc64 setjmp implementation, update grub_setjmp() attributes.
2009-04-01 13:01 ` Robert Millan
2009-04-01 13:59 ` Yoshinori K. Okuji
@ 2009-04-01 21:16 ` David Miller
1 sibling, 0 replies; 8+ messages in thread
From: David Miller @ 2009-04-01 21:16 UTC (permalink / raw)
To: grub-devel, rmh; +Cc: okuji
From: Robert Millan <rmh@aybabtu.com>
Date: Wed, 1 Apr 2009 15:01:11 +0200
> On Wed, Apr 01, 2009 at 01:17:40AM -0700, David Miller wrote:
> > From: "Yoshinori K. Okuji" <okuji@enbug.org>
> > Date: Sat, 28 Mar 2009 23:34:25 +0900
> >
> > > On Saturday 28 March 2009 22:39:48 Robert Millan wrote:
> > > > Unless there's someone else in the list who is knowledgeable about sparc
> > > > assembly and is going to review this part of David's patch, I'm going to
> > > > assume it's fine and check it in.
> > > >
> > > > This also goes for future patches sent by David. So if you will speak,
> > > > do it now :-)
> > >
> > > I know a bit, but not that much. So I vote for that we just trust him. ;)
> >
> > Ping?
>
> Committed.
Thank you.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-04-01 21:16 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-26 4:13 [PATCH]: grub: Fix sparc64 setjmp implementation, update grub_setjmp() attributes David Miller
2009-03-28 13:39 ` Robert Millan
2009-03-28 14:34 ` Yoshinori K. Okuji
2009-04-01 8:17 ` David Miller
2009-04-01 13:01 ` Robert Millan
2009-04-01 13:59 ` Yoshinori K. Okuji
2009-04-01 21:16 ` David Miller
2009-04-01 21:16 ` David Miller
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.