changelog shortlog tags branches changeset files revisions annotate raw help

Mercurial > hg > plan9front / sys/src/libthread/arm64.c

changeset 7189: 5f30fb0ada5d
author: cinap_lenrek@felloff.net
date: Fri, 03 May 2019 21:03:12 +0200
permissions: -rw-r--r--
description: libthread: initial support for arm64
1 #include <u.h>
2 #include <libc.h>
3 #include <thread.h>
4 #include "threadimpl.h"
5 
6 /* first argument goes in a register; simplest just to ignore it */
7 static void
8 launcherarm64(int, void (*f)(void *arg), void *arg)
9 {
10  (*f)(arg);
11  threadexits(nil);
12 }
13 
14 void
15 _threadinitstack(Thread *t, void (*f)(void*), void *arg)
16 {
17  uintptr *tos;
18 
19  tos = (uintptr*)&t->stk[t->stksize&~15];
20  *--tos = (uintptr)arg;
21  *--tos = (uintptr)f;
22  *--tos = 0; /* first arg to launcherarm64 */
23  *--tos = 0; /* place to store return PC */
24 
25  t->sched[JMPBUFPC] = (uintptr)launcherarm64+JMPBUFDPC;
26  t->sched[JMPBUFSP] = (uintptr)tos;
27 }
28