asm.S 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. REG_READ_WRITE(fcsr, 0x003)
  23. REG_SET_CLEAR(fcsr, 0x003)
  24. // M-mode registers
  25. REG_READ(mcause, 0x342)
  26. REG_READ(mcycle, 0xB00)
  27. REG_READ(mepc, 0x341)
  28. REG_READ(mie, 0x304)
  29. REG_SET_CLEAR(mie, 0x304)
  30. REG_READ(minstret, 0xB02)
  31. REG_READ(mip, 0x344)
  32. REG_READ(misa, 0x301)
  33. REG_READ_WRITE(mstatus, 0x300)
  34. REG_SET_CLEAR(mstatus, 0x300)
  35. REG_READ_WRITE(mtvec, 0x305)
  36. REG_READ(mvendorid, 0xF11)
  37. // S-mode registers
  38. REG_READ_WRITE(satp, 0x180)
  39. REG_READ(scause, 0x142)
  40. REG_READ_WRITE(sepc, 0x141)
  41. REG_READ(sie, 0x104)
  42. REG_SET_CLEAR(sie, 0x104)
  43. REG_READ(sip, 0x144)
  44. REG_READ_WRITE(sscratch, 0x140)
  45. REG_READ_WRITE(sstatus, 0x100)
  46. REG_SET_CLEAR(sstatus, 0x100)
  47. REG_READ(stval, 0x143)
  48. REG_READ_WRITE(stvec, 0x105)
  49. REG_READ(time, 0xC01)