asm.S 581 B

123456789101112131415161718192021222324252627282930313233343536
  1. # startmach starts a function after setting up the mach
  2. # pointer. The function is in a0, the mach pointer in a1.
  3. .globl startmach
  4. startmach:
  5. csrw sscratch, a1
  6. mv ra,a0
  7. ret
  8. .globl machp
  9. machp:
  10. csrr a0,sscratch
  11. ret
  12. /*
  13. * Label consists of a stack pointer and a programme counter
  14. * 0(%rdi) is the SP, 8(%rdi) is the PC
  15. */
  16. .global gotolabel
  17. gotolabel:
  18. LD sp,0(a0)
  19. LD x2,16(a0)
  20. LD a0,8(a0)
  21. MV ra,a0
  22. RET
  23. /* save all registers on this stack, the save stack
  24. * in the label struct.
  25. */
  26. .global slim_setlabel
  27. slim_setlabel:
  28. SD sp,0(a0)
  29. SD ra,8(a0)
  30. SD x2,16(a0)
  31. RET