summaryrefslogtreecommitdiff
path: root/lib/libpthread
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-03-02 23:41:30 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-03-02 23:41:30 +0000
commitd4625f56e5db994701c492c3cf784977c2e1b0dc (patch)
tree89693a41ccfca5ca4d99b7a937ce478c1a0dc9dd /lib/libpthread
parent3623aa59366a383494516167e784507361c47666 (diff)
Use double load/store instructions whenever possible.
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/arch/m88k/uthread_machdep.c6
-rw-r--r--lib/libpthread/arch/m88k/uthread_machdep_asm.S111
2 files changed, 45 insertions, 72 deletions
diff --git a/lib/libpthread/arch/m88k/uthread_machdep.c b/lib/libpthread/arch/m88k/uthread_machdep.c
index 435e976d04e..c73fe479eb0 100644
--- a/lib/libpthread/arch/m88k/uthread_machdep.c
+++ b/lib/libpthread/arch/m88k/uthread_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_machdep.c,v 1.1 2004/02/27 22:19:46 deraadt Exp $ */
+/* $OpenBSD: uthread_machdep.c,v 1.2 2004/03/02 23:41:29 miod Exp $ */
/*
* Copyright (c) 2004 Theo de Raadt
@@ -26,7 +26,7 @@
#define ALIGNBYTES 7
struct frame {
- long regs[30];
+ long regs[28]; /* r4-r30, r1 */
};
/*
@@ -43,7 +43,7 @@ _thread_machdep_init(statep, base, len, entry)
struct frame *f;
f = (struct frame *)(((u_int32_t)base + len - sizeof *f) & ~ALIGNBYTES);
- f->regs[29] = f->regs[27] = (u_int32_t)entry;
+ f->regs[27] = (u_int32_t)entry; /* ``saved'' r1 */
statep->sp = (int)f;
}
diff --git a/lib/libpthread/arch/m88k/uthread_machdep_asm.S b/lib/libpthread/arch/m88k/uthread_machdep_asm.S
index 9a74e5a7fae..dcf997650d8 100644
--- a/lib/libpthread/arch/m88k/uthread_machdep_asm.S
+++ b/lib/libpthread/arch/m88k/uthread_machdep_asm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_machdep_asm.S,v 1.1 2004/02/27 22:19:46 deraadt Exp $ */
+/* $OpenBSD: uthread_machdep_asm.S,v 1.2 2004/03/02 23:41:29 miod Exp $ */
/*
* Copyright (c) 2004 Theo de Raadt
@@ -18,76 +18,49 @@
#include <machine/asm.h>
- global __thread_machdep_switch
- .type __thread_machdep_switch, @function
-__thread_machdep_switch:
- subu r31,r31,4*30
+/*
+ * void _thread_machdep_switch(new, oldsave);
+ */
+ENTRY(_thread_machdep_switch)
+ subu r31, r31, 4 * 28
- st r1,r31,4*29
- st r3,r31,4*0
- st r4,r31,4*1
- st r5,r31,4*2
- st r6,r31,4*3
- st r7,r31,4*4
- st r8,r31,4*5
- st r9,r31,4*6
- st r10,r31,4*7
- st r11,r31,4*8
- st r12,r31,4*9
- st r13,r31,4*10
- st r14,r31,4*11
- st r15,r31,4*12
- st r16,r31,4*13
- st r17,r31,4*14
- st r18,r31,4*15
- st r19,r31,4*16
- st r20,r31,4*17
- st r21,r31,4*18
- st r22,r31,4*19
- st r23,r31,4*20
- st r24,r31,4*21
- st r25,r31,4*22
- st r26,r31,4*23
- st r27,r31,4*24
- st r28,r31,4*25
- st r29,r31,4*26
- st r30,r31,4*27
+ /* save all registers but r0, r2, r3 and r31 on stack */
+ st.d r4, r31, 4 * 0
+ st.d r6, r31, 4 * 2
+ st.d r8, r31, 4 * 4
+ st.d r10, r31, 4 * 6
+ st.d r12, r31, 4 * 8
+ st.d r14, r31, 4 * 10
+ st.d r16, r31, 4 * 12
+ st.d r18, r31, 4 * 14
+ st.d r20, r31, 4 * 16
+ st.d r22, r31, 4 * 18
+ st.d r24, r31, 4 * 20
+ st.d r26, r31, 4 * 22
+ st.d r28, r31, 4 * 24
+ st r30, r31, 4 * 26
+ st r1, r31, 4 * 27
- st r31,r0,r3
- ld r31,r0,r2
+ /* exchange stacks */
+ st r31, r3, 0 /* oldsave->frame = r31 */
+ ld r31, r2, 0 /* r31 = oldsave->frame */
- ld r1,r31,4*29
- ld r3,r31,4*0
- ld r4,r31,4*1
- ld r5,r31,4*2
- ld r6,r31,4*3
- ld r7,r31,4*4
- ld r8,r31,4*5
- ld r9,r31,4*6
- ld r10,r31,4*7
- ld r11,r31,4*8
- ld r12,r31,4*9
- ld r13,r31,4*10
- ld r14,r31,4*11
- ld r15,r31,4*12
- ld r16,r31,4*13
- ld r17,r31,4*14
- ld r18,r31,4*15
- ld r19,r31,4*16
- ld r20,r31,4*17
- ld r21,r31,4*18
- ld r22,r31,4*19
- ld r23,r31,4*20
- ld r24,r31,4*21
- ld r25,r31,4*22
- ld r26,r31,4*23
- ld r27,r31,4*24
- ld r28,r31,4*25
- ld r29,r31,4*26
- ld r30,r31,4*27
+ /* restore registers */
+ ld.d r4, r31, 4 * 0
+ ld.d r6, r31, 4 * 2
+ ld.d r8, r31, 4 * 4
+ ld.d r10, r31, 4 * 6
+ ld.d r12, r31, 4 * 8
+ ld.d r14, r31, 4 * 10
+ ld.d r16, r31, 4 * 12
+ ld.d r18, r31, 4 * 14
+ ld.d r20, r31, 4 * 16
+ ld.d r22, r31, 4 * 18
+ ld.d r24, r31, 4 * 20
+ ld.d r26, r31, 4 * 22
+ ld.d r28, r31, 4 * 24
+ ld r30, r31, 4 * 26
+ ld r1, r31, 4 * 27
jmp.n r1
- addu r31,r31,4*30
-
- .size __thread_machdep_switch , . - __thread_machdep_switch
- .align 8
+ addu r31, r31, 4 * 28