diff options
Diffstat (limited to 'lib/libc_r/arch')
-rw-r--r-- | lib/libc_r/arch/m68k/uthread_machdep.c | 52 | ||||
-rw-r--r-- | lib/libc_r/arch/m68k/uthread_machdep_asm.S | 18 |
2 files changed, 70 insertions, 0 deletions
diff --git a/lib/libc_r/arch/m68k/uthread_machdep.c b/lib/libc_r/arch/m68k/uthread_machdep.c new file mode 100644 index 00000000000..8afde2443f3 --- /dev/null +++ b/lib/libc_r/arch/m68k/uthread_machdep.c @@ -0,0 +1,52 @@ +/* $OpenBSD: uthread_machdep.c,v 1.1 2000/09/25 09:03:44 d Exp $ */ +/* David Leonard, <d@csee.uq.edu.au>. Public domain. */ + +/* + * Machine-dependent thread state functions for OpenBSD/m68k + */ + +#include "uthread_machdep.h" +#define ALIGNBYTES 0x3 + +struct frame { + int d2,d3,d4,d5,d6,d7; + int a2,a3,a4,a5,fp; + int link; /* frame link */ + int ra; +}; + +/* + * Given a stack and an entry function, initialise a state + * structure that can be later switched to. + */ +void +_thread_machdep_init(statep, base, len, entry) + struct _machdep_state* statep; + void *base; + int len; + void (*entry)(void); +{ + struct frame *f; + + /* Locate the initial frame, aligned at the top of the stack */ + f = (struct frame *)(((int)base + len - sizeof *f) & ~ALIGNBYTES); + + f->ra = (int)entry; + f->link = 0; + f->fp = (int)&f->link; + statep->sp = (int)f; +} + +void +_thread_machdep_save_float_state(statep) + struct _machdep_state* statep; +{ + /* fsave is a privileged instruction */ +} + +void +_thread_machdep_restore_float_state(statep) + struct _machdep_state* statep; +{ + /* frestore is a privileged instruction */ +} diff --git a/lib/libc_r/arch/m68k/uthread_machdep_asm.S b/lib/libc_r/arch/m68k/uthread_machdep_asm.S new file mode 100644 index 00000000000..30e4397b838 --- /dev/null +++ b/lib/libc_r/arch/m68k/uthread_machdep_asm.S @@ -0,0 +1,18 @@ +/* $OpenBSD: uthread_machdep_asm.S,v 1.1 2000/09/25 09:03:44 d Exp $ */ +/* David Leonard, <d@csee.uq.edu.au>. Public domain. */ + +#include <machine/asm.h> + +#define SA(x) (((x)+3)&~3) +#define FRAMESIZE 4*11 + +ENTRY(_thread_machdep_switch) + link a6, #-SA(FRAMESIZE) + moveml #0x7CFC, sp@ /* d2-d7,a2-a6 */ + movel a6@(8), a0 + movel a6@(12), a1 + movel sp, a1@ + movel a0@, sp + moveml sp@, #0x7CFC + unlk a6 + rts |