asm.S 990 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #include "asm.h"
  2. .section .text.__ebreak
  3. .global __ebreak
  4. __ebreak:
  5. ebreak
  6. ret
  7. .section .text.__wfi
  8. .global __wfi
  9. __wfi:
  10. wfi
  11. ret
  12. .section .text.__sfence_vma_all
  13. .global __sfence_vma_all
  14. __sfence_vma_all:
  15. sfence.vma
  16. ret
  17. .section .text.__sfence_vma
  18. .global __sfence_vma
  19. __sfence_vma:
  20. sfence.vma a0, a1
  21. ret
  22. // M-mode registers
  23. REG_READ(mcause, 0x342)
  24. REG_READ(mcycle, 0xB00)
  25. REG_READ(mepc, 0x341)
  26. REG_READ(mie, 0x304)
  27. REG_SET_CLEAR(mie, 0x304)
  28. REG_READ(minstret, 0xB02)
  29. REG_READ(mip, 0x344)
  30. REG_READ(misa, 0x301)
  31. REG_READ(mstatus, 0x300)
  32. REG_SET_CLEAR(mstatus, 0x300)
  33. REG_READ_WRITE(mtvec, 0x305)
  34. REG_READ(mvendorid, 0xF11)
  35. // S-mode registers
  36. REG_READ_WRITE(satp, 0x180)
  37. REG_READ(scause, 0x142)
  38. REG_READ_WRITE(sepc, 0x141)
  39. REG_READ(sie, 0x104)
  40. REG_SET_CLEAR(sie, 0x104)
  41. REG_READ(sip, 0x144)
  42. REG_READ_WRITE(sscratch, 0x140)
  43. REG_READ(sstatus, 0x100)
  44. REG_SET_CLEAR(sstatus, 0x100)
  45. REG_READ(stval, 0x143)
  46. REG_READ_WRITE(stvec, 0x105)
  47. REG_READ(time, 0xC01)