riscv32imac-unknown-none-elf-m.s 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. .text
  2. .attribute 4, 16
  3. .attribute 5, "rv32i2p0_m2p0_a2p0_c2p0"
  4. .file "3wdx7lxc78dgym21"
  5. .section .init,"ax",@progbits
  6. .globl _start
  7. _start:
  8. lui ra, %hi(_abs_start)
  9. jalr zero, %lo(_abs_start)(ra)
  10. _abs_start:
  11. .cfi_startproc
  12. .cfi_undefined ra
  13. csrwi mie, 0
  14. csrwi mip, 0
  15. li ra, 0
  16. li sp, 0
  17. li gp, 0
  18. li tp, 0
  19. li t0, 0
  20. li t1, 0
  21. li t2, 0
  22. li s0, 0
  23. li s1, 0
  24. li a3, 0
  25. li a4, 0
  26. li a5, 0
  27. li a6, 0
  28. li a7, 0
  29. li s2, 0
  30. li s3, 0
  31. li s4, 0
  32. li s5, 0
  33. li s6, 0
  34. li s7, 0
  35. li s8, 0
  36. li s9, 0
  37. li s10, 0
  38. li s11, 0
  39. li t3, 0
  40. li t4, 0
  41. li t5, 0
  42. li t6, 0
  43. .option push
  44. .option norelax
  45. .Lpcrel_hi0:
  46. auipc gp, %pcrel_hi(__global_pointer$)
  47. addi gp, gp, %pcrel_lo(.Lpcrel_hi0)
  48. .option pop
  49. csrr t2, mhartid
  50. lui t0, %hi(_max_hart_id)
  51. addi t0, t0, %lo(_max_hart_id)
  52. bltu t0, t2, abort
  53. .Lpcrel_hi1:
  54. auipc sp, %pcrel_hi(_stack_start)
  55. addi sp, sp, %pcrel_lo(.Lpcrel_hi1)
  56. lui t0, %hi(_hart_stack_size)
  57. addi t0, t0, %lo(_hart_stack_size)
  58. mul t0, t2, t0
  59. sub sp, sp, t0
  60. mv s0, sp
  61. j _start_rust
  62. .cfi_endproc
  63. .section .trap,"ax",@progbits
  64. .globl default_start_trap
  65. default_start_trap:
  66. addi sp, sp, -64
  67. sw ra, 0(sp)
  68. sw t0, 4(sp)
  69. sw t1, 8(sp)
  70. sw t2, 12(sp)
  71. sw t3, 16(sp)
  72. sw t4, 20(sp)
  73. sw t5, 24(sp)
  74. sw t6, 28(sp)
  75. sw a0, 32(sp)
  76. sw a1, 36(sp)
  77. sw a2, 40(sp)
  78. sw a3, 44(sp)
  79. sw a4, 48(sp)
  80. sw a5, 52(sp)
  81. sw a6, 56(sp)
  82. sw a7, 60(sp)
  83. mv a0, sp
  84. jal _start_trap_rust
  85. lw ra, 0(sp)
  86. lw t0, 4(sp)
  87. lw t1, 8(sp)
  88. lw t2, 12(sp)
  89. lw t3, 16(sp)
  90. lw t4, 20(sp)
  91. lw t5, 24(sp)
  92. lw t6, 28(sp)
  93. lw a0, 32(sp)
  94. lw a1, 36(sp)
  95. lw a2, 40(sp)
  96. lw a3, 44(sp)
  97. lw a4, 48(sp)
  98. lw a5, 52(sp)
  99. lw a6, 56(sp)
  100. lw a7, 60(sp)
  101. addi sp, sp, 64
  102. mret
  103. .section .text.abort,"ax",@progbits
  104. .globl abort
  105. abort:
  106. j abort