summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/arch/m68k/uthread_machdep.c
blob: 77c8019d1da724bd3eee91eed650806462335a2e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*	$OpenBSD: uthread_machdep.c,v 1.2 2003/06/02 08:11:15 miod Exp $	*/
/* David Leonard, <d@csee.uq.edu.au>. Public domain. */

/*
 * Machine-dependent thread state functions for OpenBSD/m68k
 */

#include <pthread.h>
#include "pthread_private.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 */
}