Skip to content

Instantly share code, notes, and snippets.

@heatd

heatd/riscool Secret

Created April 22, 2022 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heatd/8081c329bffe664a2bd4feb07866f23c to your computer and use it in GitHub Desktop.
Save heatd/8081c329bffe664a2bd4feb07866f23c to your computer and use it in GitHub Desktop.
Dump of assembler code for function riscv_trap_entry:
0xffffffff8008ff00 <+0>: 73 12 02 14 csrrw tp,sscratch,tp
0xffffffff8008ff04 <+4>: 63 16 02 06 bnez tp,0xffffffff8008ff70 <riscv_trap_entry+112>
0xffffffff8008ff08 <+8>: 73 12 02 14 csrrw tp,sscratch,tp
0xffffffff8008ff0c <+12>: 13 01 81 ee addi sp,sp,-280
0xffffffff8008ff10 <+16>: 06 e0 sd ra,0(sp)
0xffffffff8008ff12 <+18>: 93 00 81 11 addi ra,sp,280
0xffffffff8008ff16 <+22>: 06 e4 sd ra,8(sp)
0xffffffff8008ff18 <+24>: 12 ec sd tp,24(sp)
0xffffffff8008ff1a <+26>: 0e e8 sd gp,16(sp)
0xffffffff8008ff1c <+28>: 16 f0 sd t0,32(sp)
0xffffffff8008ff1e <+30>: 1a f4 sd t1,40(sp)
0xffffffff8008ff20 <+32>: 1e f8 sd t2,48(sp)
0xffffffff8008ff22 <+34>: 22 fc sd s0,56(sp)
0xffffffff8008ff24 <+36>: a6 e0 sd s1,64(sp)
0xffffffff8008ff26 <+38>: aa e4 sd a0,72(sp)
0xffffffff8008ff28 <+40>: ae e8 sd a1,80(sp)
0xffffffff8008ff2a <+42>: b2 ec sd a2,88(sp)
0xffffffff8008ff2c <+44>: b6 f0 sd a3,96(sp)
0xffffffff8008ff2e <+46>: ba f4 sd a4,104(sp)
0xffffffff8008ff30 <+48>: be f8 sd a5,112(sp)
0xffffffff8008ff32 <+50>: c2 fc sd a6,120(sp)
0xffffffff8008ff34 <+52>: 46 e1 sd a7,128(sp)
0xffffffff8008ff36 <+54>: 4a e5 sd s2,136(sp)
0xffffffff8008ff38 <+56>: 4e e9 sd s3,144(sp)
0xffffffff8008ff3a <+58>: 52 ed sd s4,152(sp)
0xffffffff8008ff3c <+60>: 56 f1 sd s5,160(sp)
0xffffffff8008ff3e <+62>: 5a f5 sd s6,168(sp)
--Type <RET> for more, q to quit, c to continue without paging--c
0xffffffff8008ff40 <+64>: 5e f9 sd s7,176(sp)
0xffffffff8008ff42 <+66>: 62 fd sd s8,184(sp)
0xffffffff8008ff44 <+68>: e6 e1 sd s9,192(sp)
0xffffffff8008ff46 <+70>: ea e5 sd s10,200(sp)
0xffffffff8008ff48 <+72>: ee e9 sd s11,208(sp)
0xffffffff8008ff4a <+74>: f2 ed sd t3,216(sp)
0xffffffff8008ff4c <+76>: f6 f1 sd t4,224(sp)
0xffffffff8008ff4e <+78>: fa f5 sd t5,232(sp)
0xffffffff8008ff50 <+80>: fe f9 sd t6,240(sp)
0xffffffff8008ff52 <+82>: 73 10 00 14 csrw sscratch,zero
0xffffffff8008ff56 <+86>: 73 25 10 14 csrr a0,sepc
0xffffffff8008ff5a <+90>: aa fd sd a0,248(sp)
0xffffffff8008ff5c <+92>: 73 25 20 14 csrr a0,scause
0xffffffff8008ff60 <+96>: 2a e2 sd a0,256(sp)
0xffffffff8008ff62 <+98>: 73 25 30 14 csrr a0,stval
0xffffffff8008ff66 <+102>: 2a e6 sd a0,264(sp)
0xffffffff8008ff68 <+104>: 73 25 00 10 csrr a0,sstatus
0xffffffff8008ff6c <+108>: 2a ea sd a0,272(sp)
0xffffffff8008ff6e <+110>: 95 a8 j 0xffffffff8008ffe2 <riscv_trap_entry+226>
0xffffffff8008ff70 <+112>: 23 38 22 00 sd sp,16(tp) # 0x10 <_ZN3abi8abi_dataE+16>
0xffffffff8008ff74 <+116>: 03 31 82 01 ld sp,24(tp) # 0x18 <_ZN3abi8abi_dataE+24>
0xffffffff8008ff78 <+120>: 13 01 81 ee addi sp,sp,-280
0xffffffff8008ff7c <+124>: 06 e0 sd ra,0(sp)
0xffffffff8008ff7e <+126>: 83 30 02 01 ld ra,16(tp) # 0x10 <_ZN3abi8abi_dataE+16>
0xffffffff8008ff82 <+130>: 06 e4 sd ra,8(sp)
0xffffffff8008ff84 <+132>: 73 12 02 14 csrrw tp,sscratch,tp
0xffffffff8008ff88 <+136>: 12 ec sd tp,24(sp)
0xffffffff8008ff8a <+138>: 73 12 02 14 csrrw tp,sscratch,tp
0xffffffff8008ff8e <+142>: 0e e8 sd gp,16(sp)
0xffffffff8008ff90 <+144>: 16 f0 sd t0,32(sp)
0xffffffff8008ff92 <+146>: 1a f4 sd t1,40(sp)
0xffffffff8008ff94 <+148>: 1e f8 sd t2,48(sp)
0xffffffff8008ff96 <+150>: 22 fc sd s0,56(sp)
0xffffffff8008ff98 <+152>: a6 e0 sd s1,64(sp)
0xffffffff8008ff9a <+154>: aa e4 sd a0,72(sp)
0xffffffff8008ff9c <+156>: ae e8 sd a1,80(sp)
0xffffffff8008ff9e <+158>: b2 ec sd a2,88(sp)
0xffffffff8008ffa0 <+160>: b6 f0 sd a3,96(sp)
0xffffffff8008ffa2 <+162>: ba f4 sd a4,104(sp)
0xffffffff8008ffa4 <+164>: be f8 sd a5,112(sp)
0xffffffff8008ffa6 <+166>: c2 fc sd a6,120(sp)
0xffffffff8008ffa8 <+168>: 46 e1 sd a7,128(sp)
0xffffffff8008ffaa <+170>: 4a e5 sd s2,136(sp)
0xffffffff8008ffac <+172>: 4e e9 sd s3,144(sp)
0xffffffff8008ffae <+174>: 52 ed sd s4,152(sp)
0xffffffff8008ffb0 <+176>: 56 f1 sd s5,160(sp)
0xffffffff8008ffb2 <+178>: 5a f5 sd s6,168(sp)
0xffffffff8008ffb4 <+180>: 5e f9 sd s7,176(sp)
0xffffffff8008ffb6 <+182>: 62 fd sd s8,184(sp)
0xffffffff8008ffb8 <+184>: e6 e1 sd s9,192(sp)
0xffffffff8008ffba <+186>: ea e5 sd s10,200(sp)
0xffffffff8008ffbc <+188>: ee e9 sd s11,208(sp)
0xffffffff8008ffbe <+190>: f2 ed sd t3,216(sp)
0xffffffff8008ffc0 <+192>: f6 f1 sd t4,224(sp)
0xffffffff8008ffc2 <+194>: fa f5 sd t5,232(sp)
0xffffffff8008ffc4 <+196>: fe f9 sd t6,240(sp)
0xffffffff8008ffc6 <+198>: 73 10 00 14 csrw sscratch,zero
0xffffffff8008ffca <+202>: 73 25 10 14 csrr a0,sepc
0xffffffff8008ffce <+206>: aa fd sd a0,248(sp)
0xffffffff8008ffd0 <+208>: 73 25 20 14 csrr a0,scause
0xffffffff8008ffd4 <+212>: 2a e2 sd a0,256(sp)
0xffffffff8008ffd6 <+214>: 73 25 30 14 csrr a0,stval
0xffffffff8008ffda <+218>: 2a e6 sd a0,264(sp)
0xffffffff8008ffdc <+220>: 73 25 00 10 csrr a0,sstatus
0xffffffff8008ffe0 <+224>: 2a ea sd a0,272(sp)
0xffffffff8008ffe2 <+226>: 97 41 08 00 auipc gp,0x84
0xffffffff8008ffe6 <+230>: 93 81 e1 81 addi gp,gp,-2018 # 0xffffffff80113800 <curr_id>
0xffffffff8008ffea <+234>: 0a 85 mv a0,sp
0xffffffff8008ffec <+236>: 13 71 01 ff andi sp,sp,-16
0xffffffff8008fff0 <+240>: 97 e0 05 00 auipc ra,0x5e
0xffffffff8008fff4 <+244>: e7 80 60 7a jalr 1958(ra) # 0xffffffff800ee796 <riscv_handle_trap>
0xffffffff8008fff8 <+248>: 2a 81 mv sp,a0
0xffffffff8008fffa <+250>: 82 60 ld ra,0(sp)
0xffffffff8008fffc <+252>: c2 61 ld gp,16(sp)
0xffffffff8008fffe <+254>: 82 72 ld t0,32(sp)
0xffffffff80090000 <+256>: 22 73 ld t1,40(sp)
0xffffffff80090002 <+258>: c2 73 ld t2,48(sp)
0xffffffff80090004 <+260>: 62 74 ld s0,56(sp)
0xffffffff80090006 <+262>: 86 64 ld s1,64(sp)
0xffffffff80090008 <+264>: 26 65 ld a0,72(sp)
0xffffffff8009000a <+266>: c6 65 ld a1,80(sp)
0xffffffff8009000c <+268>: 66 66 ld a2,88(sp)
0xffffffff8009000e <+270>: 86 76 ld a3,96(sp)
0xffffffff80090010 <+272>: 26 77 ld a4,104(sp)
0xffffffff80090012 <+274>: c6 77 ld a5,112(sp)
0xffffffff80090014 <+276>: 66 78 ld a6,120(sp)
0xffffffff80090016 <+278>: 8a 68 ld a7,128(sp)
0xffffffff80090018 <+280>: 2a 69 ld s2,136(sp)
0xffffffff8009001a <+282>: ca 69 ld s3,144(sp)
0xffffffff8009001c <+284>: 6a 6a ld s4,152(sp)
0xffffffff8009001e <+286>: 8a 7a ld s5,160(sp)
0xffffffff80090020 <+288>: 2a 7b ld s6,168(sp)
0xffffffff80090022 <+290>: ca 7b ld s7,176(sp)
0xffffffff80090024 <+292>: 6a 7c ld s8,184(sp)
0xffffffff80090026 <+294>: 8e 6c ld s9,192(sp)
0xffffffff80090028 <+296>: 2e 6d ld s10,200(sp)
0xffffffff8009002a <+298>: ce 6d ld s11,208(sp)
0xffffffff8009002c <+300>: 6e 6e ld t3,216(sp)
0xffffffff8009002e <+302>: 8e 7e ld t4,224(sp)
0xffffffff80090030 <+304>: 2e 7f ld t5,232(sp)
0xffffffff80090032 <+306>: 73 70 01 10 csrci sstatus,2
0xffffffff80090036 <+310>: d2 6f ld t6,272(sp)
0xffffffff80090038 <+312>: 93 ff 0f 10 andi t6,t6,256
0xffffffff8009003c <+316>: 63 94 0f 00 bnez t6,0xffffffff80090044 <riscv_trap_entry+324>
0xffffffff80090040 <+320>: 73 10 02 14 csrw sscratch,tp
0xffffffff80090044 <+324>: ce 7f ld t6,240(sp)
0xffffffff80090046 <+326>: 6e 72 ld tp,248(sp)
0xffffffff80090048 <+328>: 73 10 12 14 csrw sepc,tp
0xffffffff8009004c <+332>: 12 62 ld tp,256(sp)
0xffffffff8009004e <+334>: 73 10 22 14 csrw scause,tp
0xffffffff80090052 <+338>: 32 62 ld tp,264(sp)
0xffffffff80090054 <+340>: 73 10 32 14 csrw stval,tp
0xffffffff80090058 <+344>: 52 62 ld tp,272(sp)
0xffffffff8009005a <+346>: 73 10 02 10 csrw sstatus,tp
0xffffffff8009005e <+350>: 62 62 ld tp,24(sp)
0xffffffff80090060 <+352>: 22 61 ld sp,8(sp)
0xffffffff80090062 <+354>: 73 00 20 10 sret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment