plan9l.s 910 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "mem.h"
  2. /*
  3. * This must match io.h.
  4. */
  5. #define VectorSYSCALL 0x40
  6. /*
  7. * Used to get to the first process:
  8. * set up an interrupt return frame and IRET to user level.
  9. */
  10. TEXT touser(SB), $0
  11. PUSHL $(UDSEL) /* old ss */
  12. MOVL sp+0(FP), AX /* old sp */
  13. PUSHL AX
  14. MOVL $0x200, AX /* interrupt enable flag */
  15. PUSHL AX /* old flags */
  16. PUSHL $(UESEL) /* old cs */
  17. PUSHL $(UTZERO+32) /* old pc */
  18. MOVL $(UDSEL), AX
  19. MOVW AX, DS
  20. MOVW AX, ES
  21. MOVW AX, GS
  22. MOVW AX, FS
  23. IRETL
  24. /*
  25. * This is merely _strayintr from l.s optimised to vector
  26. * to syscall() without going through trap().
  27. */
  28. TEXT _syscallintr(SB), $0
  29. PUSHL $VectorSYSCALL /* trap type */
  30. PUSHL DS
  31. PUSHL ES
  32. PUSHL FS
  33. PUSHL GS
  34. PUSHAL
  35. MOVL $(KDSEL), AX
  36. MOVW AX, DS
  37. MOVW AX, ES
  38. PUSHL SP
  39. CALL syscall(SB)
  40. POPL AX
  41. POPAL
  42. POPL GS
  43. POPL FS
  44. POPL ES
  45. POPL DS
  46. ADDL $8, SP /* pop error code and trap type */
  47. IRETL