All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/7]:  Fix sparc64 setjmp implementation.
@ 2009-03-04  2:15 David Miller
  2009-03-04 10:59 ` Vesa Jääskeläinen
  2009-03-04 11:34 ` Vesa Jääskeläinen
  0 siblings, 2 replies; 17+ messages in thread
From: David Miller @ 2009-03-04  2:15 UTC (permalink / raw)
  To: grub-devel


This corrects the sparc64 setjmp implementation.

We need to store the return address register, the
stack pointer, and frame pointer into the jump buf.

And on longjmp we need restore those registers, flush the register
window state, and pull in the top-most register window.

2009-03-03  David S. Miller  <davem@davemloft.net>

	* normal/sparc64/setjmp.S: Fix setjmp implementation.
	* include/grub/sparc64/setjmp.h: Update grub_jmp_buf[].
---
 include/grub/sparc64/setjmp.h |    3 +--
 normal/sparc64/setjmp.S       |   18 +++++++++++++-----
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/include/grub/sparc64/setjmp.h b/include/grub/sparc64/setjmp.h
index 12d8e01..183a820 100644
--- a/include/grub/sparc64/setjmp.h
+++ b/include/grub/sparc64/setjmp.h
@@ -19,8 +19,7 @@
 #ifndef GRUB_SETJMP_CPU_HEADER
 #define GRUB_SETJMP_CPU_HEADER	1
 
-/* FIXME (sparc64).  */
-typedef unsigned long grub_jmp_buf[20];
+typedef unsigned long grub_jmp_buf[3];
 
 int grub_setjmp (grub_jmp_buf env);
 void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));
diff --git a/normal/sparc64/setjmp.S b/normal/sparc64/setjmp.S
index b1a9b6e..02e61b1 100644
--- a/normal/sparc64/setjmp.S
+++ b/normal/sparc64/setjmp.S
@@ -26,13 +26,21 @@
  * int grub_setjmp (grub_jmp_buf env)
  */
 FUNCTION(grub_setjmp)
-        ret
-         nop
+	stx	%o7, [%o0 + 0x00]
+	stx	%sp, [%o0 + 0x08]
+	retl
+	 stx	%fp, [%o0 + 0x10]
 
 /*
  * int grub_longjmp (grub_jmp_buf env, int val)
  */
 FUNCTION(grub_longjmp)
-        ret
-         nop
-
+	ldx	[%o0 + 0x10], %g1
+	movrz	%o1, 1, %o1
+	ta	0x3
+	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.1.2.253.ga34a




^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2009-03-07 14:29 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-04  2:15 [PATCH 1/7]: Fix sparc64 setjmp implementation David Miller
2009-03-04 10:59 ` Vesa Jääskeläinen
2009-03-04 11:05   ` David Miller
2009-03-04 11:34 ` Vesa Jääskeläinen
2009-03-04 11:36   ` David Miller
2009-03-04 15:58     ` Javier Martín
2009-03-04 21:02       ` David Miller
2009-03-05 13:04         ` Isaac Dupree
2009-03-05 13:24           ` David Miller
2009-03-06 18:55           ` Robert Millan
2009-03-06 19:03             ` Pavel Roskin
2009-03-07  0:39               ` David Miller
2009-03-07  5:56                 ` Pavel Roskin
2009-03-07 10:38                   ` Robert Millan
2009-03-07 14:29                     ` David Miller
2009-03-07  0:34             ` David Miller
2009-03-07 10:39               ` Robert Millan

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.