]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/teg2/lproc.s
devarch: restrict i/o port access to 64K, disallow msr 32-bit wrap arround (thanks...
[plan9front.git] / sys / src / 9 / teg2 / lproc.s
1 #include "arm.s"
2
3 /*
4  *  This is the first jump from kernel to user mode.
5  *  Fake a return from interrupt.
6  *
7  *  Enter with R0 containing the user stack pointer.
8  *  UTZERO + 0x20 is always the entry point.
9  *
10  */
11 TEXT touser(SB), 1, $-4
12         /* store the user stack pointer into the USR_r13 */
13         MOVM.DB.W [R0], (R13)
14         /* avoid the ambiguity described in notes/movm.w. */
15         MOVM.S  (R13), [R13]
16         ADD     $4, R13                 /* pop new user SP */
17
18         /* set up a PSR for user level */
19         MOVW    $(PsrMusr), R0
20         MOVW    R0, SPSR
21
22         /* push new user PSR */
23         MOVM.DB.W [R0], (R13)
24
25         /* push the new user PC on the stack */
26         MOVW    $(UTZERO+0x20), R0
27         MOVM.DB.W [R0], (R13)
28
29         RFEV7W(13)
30
31 /*
32  *  here to jump to a newly forked process
33  */
34 TEXT forkret(SB), 1, $-4
35         ADD     $(4*NREGS), R13         /* make r13 point to ureg->type */
36         MOVW    8(R13), R14             /* restore link */
37         MOVW    4(R13), R0              /* restore SPSR */
38         B       rfue(SB)