2
0

head.S 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include "sys.h"
  2. #include "picorv32.h"
  3. // The linker ensures that section .init is first
  4. .section ".init","ax"
  5. .org 0
  6. .globl _reset
  7. _reset:
  8. rdtime t0 // Record timer at reset
  9. li sp,SRAM_SIZE
  10. la t1,time_zero
  11. sw t0,(t1)
  12. j _start
  13. .type _reset, @function
  14. .size _reset, . - _reset
  15. .pushsection ".rodata","a"
  16. // Not really readonly, but close enough
  17. .balign 4
  18. .globl time_zero
  19. time_zero:
  20. .long 0
  21. .type time_zero, @object
  22. .size time_zero, . - time_zero
  23. .popsection
  24. .org 0x20
  25. .globl __irq
  26. __irq:
  27. add sp,sp,-64
  28. sw ra,0(sp)
  29. sw t0,4(sp)
  30. sw t1,8(sp)
  31. sw t2,12(sp)
  32. sw t3,16(sp)
  33. sw t4,20(sp)
  34. sw t5,24(sp)
  35. sw t6,28(sp)
  36. sw a0,32(sp)
  37. sw a1,36(sp)
  38. sw a2,40(sp)
  39. sw a3,44(sp)
  40. sw a4,48(sp)
  41. sw a5,52(sp)
  42. sw a6,56(sp)
  43. sw a7,60(sp)
  44. getq a0,q1
  45. jal _irq
  46. lw ra,0(sp)
  47. lw t0,4(sp)
  48. lw t1,8(sp)
  49. lw t2,12(sp)
  50. lw t3,16(sp)
  51. lw t4,20(sp)
  52. lw t5,24(sp)
  53. lw t6,28(sp)
  54. lw a0,32(sp)
  55. lw a1,36(sp)
  56. lw a2,40(sp)
  57. lw a3,44(sp)
  58. lw a4,48(sp)
  59. lw a5,52(sp)
  60. lw a6,56(sp)
  61. lw a7,60(sp)
  62. add sp,sp,64
  63. retirq
  64. .type __irq, @function
  65. .size __irq, . - __irq