Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LehEI-0007pK-KF for mharc-grub-devel@gnu.org; Tue, 03 Mar 2009 21:53:06 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LehEG-0007nt-BG for grub-devel@gnu.org; Tue, 03 Mar 2009 21:53:04 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LehEF-0007n2-7l for grub-devel@gnu.org; Tue, 03 Mar 2009 21:53:03 -0500 Received: from [199.232.76.173] (port=33226 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LehED-0007ma-Am for grub-devel@gnu.org; Tue, 03 Mar 2009 21:53:01 -0500 Received: from [74.93.104.97] (port=55408 helo=sunset.davemloft.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LehEC-00045m-PD for grub-devel@gnu.org; Tue, 03 Mar 2009 21:53:01 -0500 Received: from localhost (localhost [127.0.0.1]) by sunset.davemloft.net (Postfix) with ESMTP id BE37435C04F for ; Tue, 3 Mar 2009 18:15:13 -0800 (PST) Date: Tue, 03 Mar 2009 18:15:13 -0800 (PST) Message-Id: <20090303.181513.19285049.davem@davemloft.net> To: grub-devel@gnu.org From: David Miller X-Mailer: Mew version 6.1 on Emacs 22.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: [PATCH 1/7]: Fix sparc64 setjmp implementation. X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 02:53:05 -0000 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 * 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