lproc.s 872 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "arm.s"
  2. /*
  3. * This is the first jump from kernel to user mode.
  4. * Fake a return from interrupt.
  5. *
  6. * Enter with R0 containing the user stack pointer.
  7. * UTZERO + 0x20 is always the entry point.
  8. *
  9. */
  10. TEXT touser(SB), 1, $-4
  11. /* store the user stack pointer into the USR_r13 */
  12. MOVM.DB.W [R0], (R13)
  13. /* avoid the ambiguity described in notes/movm.w. */
  14. MOVM.S (R13), [R13]
  15. ADD $4, R13 /* pop new user SP */
  16. /* set up a PSR for user level */
  17. MOVW $(PsrMusr), R0
  18. MOVW R0, SPSR
  19. /* push new user PSR */
  20. MOVM.DB.W [R0], (R13)
  21. /* push the new user PC on the stack */
  22. MOVW $(UTZERO+0x20), R0
  23. MOVM.DB.W [R0], (R13)
  24. RFEV7W(13)
  25. /*
  26. * here to jump to a newly forked process
  27. */
  28. TEXT forkret(SB), 1, $-4
  29. ADD $(4*NREGS), R13 /* make r13 point to ureg->type */
  30. MOVW 8(R13), R14 /* restore link */
  31. MOVW 4(R13), R0 /* restore SPSR */
  32. B rfue(SB)