2
0

debug.S 848 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include "compiler.h"
  2. #include "sections.h"
  3. #include "picorv32.h"
  4. #include "ioregs.h"
  5. // Debug functions to read and write x-registers from interrupt
  6. // mode by register number
  7. .pushsection ".text.hot.rdxreg","ax"
  8. .globl rdxreg
  9. .balign 4
  10. rdxreg:
  11. la a3,_xreg_smc
  12. lw a2,8(a3) // addqxi a0,zero,0
  13. andi a0,a0,31
  14. slli a0,a0,15 // rs1
  15. or a2,a2,a0
  16. sw a2,(a3)
  17. jr a3
  18. .type rdxreg, @function
  19. .size rdxreg, . - rdxreg
  20. .popsection
  21. .pushsection ".text.hot.wrxreg","ax"
  22. .globl wrxreg
  23. .balign 4
  24. wrxreg:
  25. la a3,_xreg_smc
  26. lw a2,12(a3) // addxqi zero,a1,0
  27. andi a0,a0,31
  28. slli a0,a0,7 // rd
  29. or a2,a2,a0
  30. sw a2,(a3)
  31. jr a3
  32. .type wrxreg, @function
  33. .size wrxreg, . - wrxreg
  34. .popsection
  35. __rwtext
  36. .balign 4
  37. .option norvc
  38. _xreg_smc:
  39. nop
  40. ret
  41. addqxi a0,zero,0
  42. addxqi zero,a1,0
  43. .type _xreg_smc, @function
  44. .size _xreg_smc, . - _xreg_smc