summaryrefslogtreecommitdiff
path: root/lib/libpthread/arch/m68k/uthread_machdep.c
diff options
context:
space:
mode:
authorDavid Leonard <d@cvs.openbsd.org>2000-09-25 09:03:45 +0000
committerDavid Leonard <d@cvs.openbsd.org>2000-09-25 09:03:45 +0000
commit5d20f3bacaeefec3f807d34780c431ba952d1747 (patch)
tree53af7fee641af81d075ca84577a4965088683be2 /lib/libpthread/arch/m68k/uthread_machdep.c
parentb6d4442fa6ad89d8378b8ff40f0a6bbf1a63b838 (diff)
prepare for switching threads
Diffstat (limited to 'lib/libpthread/arch/m68k/uthread_machdep.c')
-rw-r--r--lib/libpthread/arch/m68k/uthread_machdep.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/lib/libpthread/arch/m68k/uthread_machdep.c b/lib/libpthread/arch/m68k/uthread_machdep.c
new file mode 100644
index 00000000000..8afde2443f3
--- /dev/null
+++ b/lib/libpthread/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 */
+}