about summary refs log tree commit diff
path: root/src/signal
diff options
context:
space:
mode:
authorrofl0r <retnyg@gmx.net>2012-11-09 23:36:55 +0100
committerrofl0r <retnyg@gmx.net>2012-11-13 19:12:25 +0100
commit1c8eb8bad791fe9d01d0d4ab77882db634fa933d (patch)
treed3faf83663c1383f7ea16a0e6c68b3e2f4cc968a /src/signal
parent7669d1e334e6b96455eece78da43bf830b93d697 (diff)
downloadmusl-1c8eb8bad791fe9d01d0d4ab77882db634fa933d.tar.gz
musl-1c8eb8bad791fe9d01d0d4ab77882db634fa933d.tar.xz
musl-1c8eb8bad791fe9d01d0d4ab77882db634fa933d.zip
PPC port cleaned up, static linking works well now.
Diffstat (limited to 'src/signal')
-rw-r--r--src/signal/powerpc/restore.s11
-rw-r--r--src/signal/powerpc/sigsetjmp.s34
-rw-r--r--src/signal/ppc/restore.S13
-rw-r--r--src/signal/ppc/sigsetjmp.S12
4 files changed, 45 insertions, 25 deletions
diff --git a/src/signal/powerpc/restore.s b/src/signal/powerpc/restore.s
new file mode 100644
index 00000000..fd7bcba5
--- /dev/null
+++ b/src/signal/powerpc/restore.s
@@ -0,0 +1,11 @@
+        .global __restore
+        .type __restore,%function
+__restore:
+        li      0, 119 #__NR_sigreturn
+        sc
+
+        .global __restore_rt
+        .type __restore_rt,%function
+__restore_rt:
+        li      0, 172 # __NR_rt_sigreturn
+        sc
diff --git a/src/signal/powerpc/sigsetjmp.s b/src/signal/powerpc/sigsetjmp.s
new file mode 100644
index 00000000..0b79dcce
--- /dev/null
+++ b/src/signal/powerpc/sigsetjmp.s
@@ -0,0 +1,34 @@
+        .global sigsetjmp
+        .type sigsetjmp,%function
+sigsetjmp:
+	#int sigsetjmp(sigjmp_buf buf, int save)
+	#		r3		r4
+	#0) store save into buf->__fl
+	stw 4, 256(3)
+	#1) compare save with 0
+	cmpwi cr7, 4, 0
+	#2) if its 0, goto setjmp code
+	beq- cr7, 1f
+	#3) else: we must call pthread_sigmask(SIG_SETMASK, 0, (sigset_t *)buf->__ss);
+	# thus store r3 on the stack, to restore it later
+	stw 3, -4(1)
+	# store old link reg
+	mflr 0
+	stw 0, -8(1)
+	# increase stack frame by 16
+	subi 1, 1, 16
+	# 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 sp
+	addi 1, 1, 16
+	#restore r3
+	lwz 3, -4(1)
+	#restore link reg
+	lwz 0, -8(1)
+	mtlr 0
+1:
+	b setjmp
diff --git a/src/signal/ppc/restore.S b/src/signal/ppc/restore.S
deleted file mode 100644
index 50887e91..00000000
--- a/src/signal/ppc/restore.S
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <bits/asm.h>
-#include <bits/syscall.h>
-        .global __restore
-        .type __restore,@function
-__restore:
-        li      r0, __NR_sigreturn
-        sc
-
-        .global __restore_rt
-        .type __restore_rt,@function
-__restore_rt:
-        li      r0, __NR_rt_sigreturn
-        sc
diff --git a/src/signal/ppc/sigsetjmp.S b/src/signal/ppc/sigsetjmp.S
deleted file mode 100644
index 527ef8e4..00000000
--- a/src/signal/ppc/sigsetjmp.S
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <bits/asm.h>
-        .global sigsetjmp
-        .type sigsetjmp,@function
-sigsetjmp:
-        lwz     r4, 64*4-2*4(r3)        // Second last long.
-        cmpi    r4, 0, r4, 0
-        bne     r4, 1f
-        addi    r5, r3, 64*4-1*4        // Address of last long.
-        li      r4, 0
-        li      r3, 2
-        bl      sigprocmask
-1:      b       setjmp