# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# 
# T2 SDE: package/.../dietlibc/sparc64-longjmp.patch
# Copyright (C) 2006 The T2 SDE Project
# 
# More information can be found in the files COPYING and README.
# 
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- T2-COPYRIGHT-NOTE-END ---

This fixes the sparc64 longjmp to inject the return value at the correct
memory location (and not SIGBUS). MC_G1 is just the index in the register
array, and before that array there are 4 more words placed, thus the offset
4 and multiple with the word-size ...

  - Rene Rebe <rene@exactcode.de>

--- dietlibc-0.29/sparc64/longjmp.S	2002-09-16 11:17:02.000000000 +0000
+++ dietlibc-0.29-fixed/sparc64/longjmp.S	2006-06-21 15:00:15.000000000 +0000
@@ -11,7 +11,7 @@
 .type	__libc_longjmp,function
 __libc_longjmp:
 	movrz	%o1, 1, %o1			/* never return 0 in setjmp */
-	stx	%o1, [ %o0+MC_G1 ]		/* save return value in context */
+	stx	%o1, [%o0 + (4+MC_G1) * 8]	/* save return value in context */
 	ld	[ %o0+FLAG_SAVEMASK ], %o1	/* has setjmp saved the signalmask ? */
 	ta	0x6f				/* setcontext / restore context */
 .size	__libc_longjmp,.-__libc_longjmp