aboutsummaryrefslogtreecommitdiff
path: root/src/libthread/sun4u.c
blob: 5eb2135ece3661bfef35cc6ff2b0617f2d1e1142 (plain)
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
#include "threadimpl.h"

static void
launchersparc(int o0, int o1, int o2, int o3, int o4,
	void (*f)(void *arg), void *arg)
{
	(*f)(arg);
	threadexits(nil);
}

void
_threadinitstack(Thread *t, void (*f)(void*), void *arg)
{
	ulong *tos, *stk;

	tos = (ulong*)&t->stk[t->stksize&~7];
	stk = tos;
	--stk;
	*--stk = (ulong)arg;
	*--stk = (ulong)f;
	t->sched.link = (ulong)launchersparc - 8;
	t->sched.input[6] = 0;
	t->sched.sp = (ulong)stk - 0x5c;
}