about summary refs log tree commit diff
path: root/src/signal/powerpc/sigsetjmp.s
diff options
context:
space:
mode:
authorrofl0r <retnyg@gmx.net>2012-11-19 06:21:48 +0100
committerrofl0r <retnyg@gmx.net>2012-11-19 16:58:09 +0100
commit3fae236e00068d17e007275717940f5d5e94ba1a (patch)
treecd95a0eb060b4e31cf8993e4ffd08fe9597e9689 /src/signal/powerpc/sigsetjmp.s
parent6c0cba819fb593f1efa33e0acd0bf59597279d97 (diff)
downloadmusl-3fae236e00068d17e007275717940f5d5e94ba1a.tar.gz
musl-3fae236e00068d17e007275717940f5d5e94ba1a.tar.xz
musl-3fae236e00068d17e007275717940f5d5e94ba1a.zip
powerpc: handle syscall error in clone.
sigsetjmp: store temporaries in jmp_buf rather than on stack.
Diffstat (limited to 'src/signal/powerpc/sigsetjmp.s')
-rw-r--r--src/signal/powerpc/sigsetjmp.s29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/signal/powerpc/sigsetjmp.s b/src/signal/powerpc/sigsetjmp.s
index deed732f..a23463d2 100644
--- a/src/signal/powerpc/sigsetjmp.s
+++ b/src/signal/powerpc/sigsetjmp.s
@@ -10,25 +10,26 @@ sigsetjmp:
 	#2) if its 0, goto setjmp code
 	beq- cr7, 1f
 	#3) else: we must call pthread_sigmask(SIG_SETMASK, 0, (sigset_t *)buf->__ss);
-	# increase stack frame by 16
-	subi 1, 1, 16
-	# thus store r3 on the stack, to restore it later
-	stw 3, 12(1)
-	# store old link reg
-	mflr 0
-	stw 0, 8(1)
+	# store non-volatile regs 30, 31 into the setjmp buf
+	stw 30, 0(3)
+	stw 31, 4(3)
+	# use them to store the pointer to the jmpbuf and the link reg
+	mr 30, 3
+	mflr 31
+	
 	# put pointer to ss buf into r5 (3rd arg)
 	addi 5, 3, 260
 	# put "2" i.e. SIG_SETMASK in r3
 	li 3, 2
 	li 4, 0
 	bl pthread_sigmask
-	#restore r3
-	lwz 3, 12(1)
-	#restore link reg
-	lwz 0, 8(1)
-	mtlr 0
-	#restore sp
-	addi 1, 1, 16
+	
+	#restore jmpbuf pointer and link reg
+	mr 3, 30
+	mtlr 31
+	#resore non-volatile regs
+	lwz 30, 0(3)
+	lwz 31, 4(3)
+
 1:
 	b setjmp