Skip to contentSkip to conversation

: Fix sparc64 setjmp

PATCH In review David Miller 1 participant 1 message Mar 5, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/10 : Fix sparc64 setjmp

2009-03-03 David S. Miller <[email protected]>

* normal/sparc64/setjmp.S: Fix setjmp implementation.
* include/grub/sparc64/setjmp.h: Update grub_jmp_buf[].

---
 include/grub/sparc64/setjmp.h |    7 ++++---
 normal/sparc64/setjmp.S       |   20 ++++++++++++++------
 2 files changed, 18 insertions(+), 9 deletions(-)
include/grub/sparc64/setjmp.h +4 -3
index 12d8e01..c8abb12 100644
@@ -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,8 +19,9 @@
 #ifndef GRUB_SETJMP_CPU_HEADER
 #define GRUB_SETJMP_CPU_HEADER	1
 
-/* FIXME (sparc64).  */
-typedef unsigned long grub_jmp_buf[20];
+#include <grub/types.h>
+
+typedef grub_uint64_t grub_jmp_buf[3];
 
 int grub_setjmp (grub_jmp_buf env);
 void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));
normal/sparc64/setjmp.S +14 -6
index b1a9b6e..827299c 100644
@@ -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,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
Signature · 1 line
1.6.2