Fix machineCsr test

This commit is contained in:
Dolu1990 2020-05-12 23:55:47 +02:00
parent cb44a474fc
commit 0471c7ad76
5 changed files with 239 additions and 181 deletions

View File

@ -29,26 +29,26 @@ Disassembly of section .crt_section:
80000044: 01de7f33 and t5,t3,t4
80000048: 000f1863 bnez t5,80000058 <mepcFixed>
8000004c: 34102ef3 csrr t4,mepc
80000050: 004e8e93 addi t4,t4,4 # 80000004 <unalignedPcA+0xfffffe60>
80000050: 004e8e93 addi t4,t4,4 # 80000004 <unalignedPcA+0xfffffe28>
80000054: 341e9073 csrw mepc,t4
80000058 <mepcFixed>:
80000058: 80000eb7 lui t4,0x80000
8000005c: 003e8e93 addi t4,t4,3 # 80000003 <unalignedPcA+0xfffffe5f>
8000005c: 003e8e93 addi t4,t4,3 # 80000003 <unalignedPcA+0xfffffe27>
80000060: 01ce9863 bne t4,t3,80000070 <noSoftwareInterrupt>
80000064: f0013c37 lui s8,0xf0013
80000068: 00000c93 li s9,0
8000006c: 019c2023 sw s9,0(s8) # f0013000 <unalignedPcA+0x70012e5c>
8000006c: 019c2023 sw s9,0(s8) # f0013000 <unalignedPcA+0x70012e24>
80000070 <noSoftwareInterrupt>:
80000070: 80000eb7 lui t4,0x80000
80000074: 007e8e93 addi t4,t4,7 # 80000007 <unalignedPcA+0xfffffe63>
80000074: 007e8e93 addi t4,t4,7 # 80000007 <unalignedPcA+0xfffffe2b>
80000078: 01ce9463 bne t4,t3,80000080 <noTimerInterrupt>
8000007c: 30405073 csrwi mie,0
80000080 <noTimerInterrupt>:
80000080: 80000eb7 lui t4,0x80000
80000084: 00be8e93 addi t4,t4,11 # 8000000b <unalignedPcA+0xfffffe67>
80000084: 00be8e93 addi t4,t4,11 # 8000000b <unalignedPcA+0xfffffe2f>
80000088: 01ce9463 bne t4,t3,80000090 <noExernalInterrupt>
8000008c: 30405073 csrwi mie,0
@ -65,7 +65,7 @@ Disassembly of section .crt_section:
800000ac: 30429073 csrw mie,t0
800000b0: f0013c37 lui s8,0xf0013
800000b4: 00100c93 li s9,1
800000b8: 019c2023 sw s9,0(s8) # f0013000 <unalignedPcA+0x70012e5c>
800000b8: 019c2023 sw s9,0(s8) # f0013000 <unalignedPcA+0x70012e24>
800000bc: 00000013 nop
800000c0: 00000013 nop
800000c4: 00000013 nop
@ -101,41 +101,55 @@ Disassembly of section .crt_section:
8000013c: 00000013 nop
80000140: 00500e13 li t3,5
80000144: f01001b7 lui gp,0xf0100
80000148: f4018193 addi gp,gp,-192 # f00fff40 <unalignedPcA+0x700ffd9c>
80000148: f4018193 addi gp,gp,-192 # f00fff40 <unalignedPcA+0x700ffd64>
8000014c: 0001a203 lw tp,0(gp)
80000150: 0041a283 lw t0,4(gp)
80000154: 3ff20213 addi tp,tp,1023 # 3ff <trap_entry-0x7ffffc21>
80000158: 0041a423 sw tp,8(gp)
8000015c: 0051a623 sw t0,12(gp)
80000160: 00600e13 li t3,6
80000164: 08000213 li tp,128
80000168: 30421073 csrw mie,tp
8000016c: 00700e13 li t3,7
80000170: 10500073 wfi
80000174: 00800e13 li t3,8
80000178: 00100193 li gp,1
8000017c: 0041a023 sw tp,0(gp)
80000180: 00900e13 li t3,9
80000184: 00419023 sh tp,0(gp)
80000188: 00a00e13 li t3,10
8000018c: 0001a203 lw tp,0(gp)
80000190: 00b00e13 li t3,11
80000194: 00019203 lh tp,0(gp)
80000198: 00c00e13 li t3,12
8000019c: 00d00e13 li t3,13
800001a0: 00002083 lw ra,0(zero) # 0 <trap_entry-0x80000020>
80000160: 00000013 nop
80000164: 00000013 nop
80000168: 00000013 nop
8000016c: 00000013 nop
80000170: 00000013 nop
80000174: 00000013 nop
80000178: 00000013 nop
8000017c: 00000013 nop
80000180: 00000013 nop
80000184: 00000013 nop
80000188: 00000013 nop
8000018c: 00000013 nop
80000190: 00000013 nop
80000194: 00000013 nop
80000198: 00600e13 li t3,6
8000019c: 08000213 li tp,128
800001a0: 30421073 csrw mie,tp
800001a4: 00700e13 li t3,7
800001a8: 10500073 wfi
800001ac: 00800e13 li t3,8
800001b0: 00100193 li gp,1
800001b4: 0041a023 sw tp,0(gp)
800001b8: 00900e13 li t3,9
800001bc: 00419023 sh tp,0(gp)
800001c0: 00a00e13 li t3,10
800001c4: 0001a203 lw tp,0(gp)
800001c8: 00b00e13 li t3,11
800001cc: 00019203 lh tp,0(gp)
800001d0: 00c00e13 li t3,12
800001d4: 00d00e13 li t3,13
800001d8: 00002083 lw ra,0(zero) # 0 <trap_entry-0x80000020>
800001a4 <unalignedPcA>:
800001a4: 0020006f j 800001a6 <unalignedPcA+0x2>
800001a8: 00002083 lw ra,0(zero) # 0 <trap_entry-0x80000020>
800001ac: 00e00e13 li t3,14
800001b0: 20200073 hret
800001b4: 00f00e13 li t3,15
800001b8: f01000b7 lui ra,0xf0100
800001bc: f6008093 addi ra,ra,-160 # f00fff60 <unalignedPcA+0x700ffdbc>
800001c0: 0000a103 lw sp,0(ra)
800001c4: 01000e13 li t3,16
800001c8: 0020a023 sw sp,0(ra)
800001cc: 01100e13 li t3,17
800001d0: 00008067 ret
800001dc <unalignedPcA>:
800001dc: 0020006f j 800001de <unalignedPcA+0x2>
800001e0: 00002083 lw ra,0(zero) # 0 <trap_entry-0x80000020>
800001e4: 00e00e13 li t3,14
800001e8: 20200073 hret
800001ec: 00f00e13 li t3,15
800001f0: f01000b7 lui ra,0xf0100
800001f4: f6008093 addi ra,ra,-160 # f00fff60 <unalignedPcA+0x700ffd84>
800001f8: 0000a103 lw sp,0(ra)
800001fc: 01000e13 li t3,16
80000200: 0020a023 sw sp,0(ra)
80000204: 01100e13 li t3,17
80000208: 00008067 ret
...

View File

@ -21,13 +21,17 @@
:100130001300000013000000130000001300000073
:10014000130E5000B70110F0938101F403A20100D7
:1001500083A241001302F23F23A4410023A65100D1
:10016000130E60001302000873104230130E70006B
:1001700073005010130E80009301100023A0410063
:10018000130E900023904100130EA00003A2010063
:10019000130EB00003920100130EC000130ED00026
:1001A000832000006F00200083200000130EE00079
:1001B00073002020130EF000B70010F0938000F6BB
:1001C00003A10000130E000123A02000130E100154
:1001D0006780000000000000000000000000000038
:100160001300000013000000130000001300000043
:100170001300000013000000130000001300000033
:100180001300000013000000130000001300000023
:100190001300000013000000130E6000130200089B
:1001A00073104230130E700073005010130E800055
:1001B0009301100023A04100130E900023904100F2
:1001C000130EA00003A20100130EB0000392010061
:1001D000130EC000130ED000832000006F0020001B
:1001E00083200000130EE00073002020130EF000A7
:1001F000B70010F0938000F603A10000130E000179
:1002000023A02000130E10016780000000000000F2
:1002100000000000000000000000000000000000DE
:0400000580000094E3
:00000001FF

View File

@ -5,8 +5,7 @@ build/machineCsrCompressed.elf: file format elf32-littleriscv
Disassembly of section .crt_section:
80000000 <trap_entry-0x20>:
80000000: a071 j 8000008c <_start>
80000002: 0001 nop
80000000: 0940006f j 80000094 <_start>
80000004: 00000013 nop
80000008: 00000013 nop
8000000c: 00000013 nop
@ -17,123 +16,140 @@ Disassembly of section .crt_section:
80000020 <trap_entry>:
80000020: 34202e73 csrr t3,mcause
80000024: 000e1c63 bnez t3,8000003c <notICmdAlignementException>
80000024: 000e1e63 bnez t3,80000040 <notICmdAlignementException>
80000028: ffc00f13 li t5,-4
8000002c: 34102ef3 csrr t4,mepc
80000030: 01eefeb3 and t4,t4,t5
80000034: 0e91 addi t4,t4,4
80000036: 341e9073 csrw mepc,t4
8000003a: a821 j 80000052 <mepcFixed>
80000034: 004e8e93 addi t4,t4,4
80000038: 341e9073 csrw mepc,t4
8000003c: 01c0006f j 80000058 <mepcFixed>
8000003c <notICmdAlignementException>:
8000003c: 80000eb7 lui t4,0x80000
80000040: 01de7f33 and t5,t3,t4
80000044: 000f1763 bnez t5,80000052 <mepcFixed>
80000048: 34102ef3 csrr t4,mepc
8000004c: 0e91 addi t4,t4,4
8000004e: 341e9073 csrw mepc,t4
80000040 <notICmdAlignementException>:
80000040: 80000eb7 lui t4,0x80000
80000044: 01de7f33 and t5,t3,t4
80000048: 000f1863 bnez t5,80000058 <mepcFixed>
8000004c: 34102ef3 csrr t4,mepc
80000050: 004e8e93 addi t4,t4,4 # 80000004 <unalignedPcA+0xfffffe28>
80000054: 341e9073 csrw mepc,t4
80000052 <mepcFixed>:
80000052: 80000eb7 lui t4,0x80000
80000056: 003e8e93 addi t4,t4,3 # 80000003 <_start+0xffffff77>
8000005a: 01ce9763 bne t4,t3,80000068 <noSoftwareInterrupt>
8000005e: f0013c37 lui s8,0xf0013
80000062: 4c81 li s9,0
80000064: 019c2023 sw s9,0(s8) # f0013000 <_start+0x70012f74>
80000058 <mepcFixed>:
80000058: 80000eb7 lui t4,0x80000
8000005c: 003e8e93 addi t4,t4,3 # 80000003 <unalignedPcA+0xfffffe27>
80000060: 01ce9863 bne t4,t3,80000070 <noSoftwareInterrupt>
80000064: f0013c37 lui s8,0xf0013
80000068: 00000c93 li s9,0
8000006c: 019c2023 sw s9,0(s8) # f0013000 <unalignedPcA+0x70012e24>
80000068 <noSoftwareInterrupt>:
80000068: 80000eb7 lui t4,0x80000
8000006c: 007e8e93 addi t4,t4,7 # 80000007 <_start+0xffffff7b>
80000070: 01ce9463 bne t4,t3,80000078 <noTimerInterrupt>
80000074: 30405073 csrwi mie,0
80000070 <noSoftwareInterrupt>:
80000070: 80000eb7 lui t4,0x80000
80000074: 007e8e93 addi t4,t4,7 # 80000007 <unalignedPcA+0xfffffe2b>
80000078: 01ce9463 bne t4,t3,80000080 <noTimerInterrupt>
8000007c: 30405073 csrwi mie,0
80000078 <noTimerInterrupt>:
80000078: 80000eb7 lui t4,0x80000
8000007c: 00be8e93 addi t4,t4,11 # 8000000b <_start+0xffffff7f>
80000080: 01ce9463 bne t4,t3,80000088 <noExernalInterrupt>
80000084: 30405073 csrwi mie,0
80000080 <noTimerInterrupt>:
80000080: 80000eb7 lui t4,0x80000
80000084: 00be8e93 addi t4,t4,11 # 8000000b <unalignedPcA+0xfffffe2f>
80000088: 01ce9463 bne t4,t3,80000090 <noExernalInterrupt>
8000008c: 30405073 csrwi mie,0
80000088 <noExernalInterrupt>:
80000088: 30200073 mret
80000090 <noExernalInterrupt>:
80000090: 30200073 mret
8000008c <_start>:
8000008c: 4e05 li t3,1
8000008e: 00000073 ecall
80000092: 4e09 li t3,2
80000094: 42a1 li t0,8
80000096: 3002a073 csrs mstatus,t0
8000009a: 42a1 li t0,8
8000009c: 30429073 csrw mie,t0
800000a0: f0013c37 lui s8,0xf0013
800000a4: 4c85 li s9,1
800000a6: 019c2023 sw s9,0(s8) # f0013000 <_start+0x70012f74>
800000aa: 0001 nop
800000ac: 0001 nop
800000ae: 0001 nop
800000b0: 0001 nop
800000b2: 0001 nop
800000b4: 0001 nop
800000b6: 0001 nop
800000b8: 0001 nop
800000ba: 0001 nop
800000bc: 0001 nop
800000be: 0001 nop
800000c0: 0001 nop
800000c2: 4e0d li t3,3
800000c4: 08000293 li t0,128
800000c8: 30429073 csrw mie,t0
800000cc: 0001 nop
800000ce: 0001 nop
800000d0: 0001 nop
800000d2: 0001 nop
800000d4: 0001 nop
800000d6: 0001 nop
800000d8: 0001 nop
800000da: 4e11 li t3,4
800000dc: 000012b7 lui t0,0x1
800000e0: 80028293 addi t0,t0,-2048 # 800 <trap_entry-0x7ffff820>
800000e4: 30429073 csrw mie,t0
800000e8: 0001 nop
800000ea: 0001 nop
800000ec: 0001 nop
800000ee: 0001 nop
800000f0: 0001 nop
800000f2: 0001 nop
800000f4: 0001 nop
800000f6: 4e15 li t3,5
800000f8: f01001b7 lui gp,0xf0100
800000fc: f4018193 addi gp,gp,-192 # f00fff40 <_start+0x700ffeb4>
80000100: 0001a203 lw tp,0(gp)
80000104: 0041a283 lw t0,4(gp)
80000108: 3ff20213 addi tp,tp,1023 # 3ff <trap_entry-0x7ffffc21>
8000010c: 0041a423 sw tp,8(gp)
80000110: 0051a623 sw t0,12(gp)
80000114: 4e19 li t3,6
80000116: 08000213 li tp,128
8000011a: 30421073 csrw mie,tp
8000011e: 4e1d li t3,7
80000120: 10500073 wfi
80000124: 4e21 li t3,8
80000126: 4185 li gp,1
80000128: 0041a023 sw tp,0(gp)
8000012c: 4e25 li t3,9
8000012e: 00419023 sh tp,0(gp)
80000132: 4e29 li t3,10
80000134: 0001a203 lw tp,0(gp)
80000138: 4e2d li t3,11
8000013a: 00019203 lh tp,0(gp)
8000013e: 4e31 li t3,12
80000140: 4e35 li t3,13
80000142: 00002083 lw ra,0(zero) # 0 <trap_entry-0x80000020>
80000146: 00002083 lw ra,0(zero) # 0 <trap_entry-0x80000020>
8000014a: 4e39 li t3,14
8000014c: 20200073 hret
80000150: 4e3d li t3,15
80000152: f01000b7 lui ra,0xf0100
80000156: f6008093 addi ra,ra,-160 # f00fff60 <_start+0x700ffed4>
8000015a: 0000a103 lw sp,0(ra)
8000015e: 4e41 li t3,16
80000160: 0020a023 sw sp,0(ra)
80000164: 4e45 li t3,17
80000166: 8082 ret
80000094 <_start>:
80000094: 00100e13 li t3,1
80000098: 00000073 ecall
8000009c: 00200e13 li t3,2
800000a0: 00800293 li t0,8
800000a4: 3002a073 csrs mstatus,t0
800000a8: 00800293 li t0,8
800000ac: 30429073 csrw mie,t0
800000b0: f0013c37 lui s8,0xf0013
800000b4: 00100c93 li s9,1
800000b8: 019c2023 sw s9,0(s8) # f0013000 <unalignedPcA+0x70012e24>
800000bc: 00000013 nop
800000c0: 00000013 nop
800000c4: 00000013 nop
800000c8: 00000013 nop
800000cc: 00000013 nop
800000d0: 00000013 nop
800000d4: 00000013 nop
800000d8: 00000013 nop
800000dc: 00000013 nop
800000e0: 00000013 nop
800000e4: 00000013 nop
800000e8: 00000013 nop
800000ec: 00300e13 li t3,3
800000f0: 08000293 li t0,128
800000f4: 30429073 csrw mie,t0
800000f8: 00000013 nop
800000fc: 00000013 nop
80000100: 00000013 nop
80000104: 00000013 nop
80000108: 00000013 nop
8000010c: 00000013 nop
80000110: 00000013 nop
80000114: 00400e13 li t3,4
80000118: 000012b7 lui t0,0x1
8000011c: 80028293 addi t0,t0,-2048 # 800 <trap_entry-0x7ffff820>
80000120: 30429073 csrw mie,t0
80000124: 00000013 nop
80000128: 00000013 nop
8000012c: 00000013 nop
80000130: 00000013 nop
80000134: 00000013 nop
80000138: 00000013 nop
8000013c: 00000013 nop
80000140: 00500e13 li t3,5
80000144: f01001b7 lui gp,0xf0100
80000148: f4018193 addi gp,gp,-192 # f00fff40 <unalignedPcA+0x700ffd64>
8000014c: 0001a203 lw tp,0(gp)
80000150: 0041a283 lw t0,4(gp)
80000154: 3ff20213 addi tp,tp,1023 # 3ff <trap_entry-0x7ffffc21>
80000158: 0041a423 sw tp,8(gp)
8000015c: 0051a623 sw t0,12(gp)
80000160: 00000013 nop
80000164: 00000013 nop
80000168: 00000013 nop
8000016c: 00000013 nop
80000170: 00000013 nop
80000174: 00000013 nop
80000178: 00000013 nop
8000017c: 00000013 nop
80000180: 00000013 nop
80000184: 00000013 nop
80000188: 00000013 nop
8000018c: 00000013 nop
80000190: 00000013 nop
80000194: 00000013 nop
80000198: 00600e13 li t3,6
8000019c: 08000213 li tp,128
800001a0: 30421073 csrw mie,tp
800001a4: 00700e13 li t3,7
800001a8: 10500073 wfi
800001ac: 00800e13 li t3,8
800001b0: 00100193 li gp,1
800001b4: 0041a023 sw tp,0(gp)
800001b8: 00900e13 li t3,9
800001bc: 00419023 sh tp,0(gp)
800001c0: 00a00e13 li t3,10
800001c4: 0001a203 lw tp,0(gp)
800001c8: 00b00e13 li t3,11
800001cc: 00019203 lh tp,0(gp)
800001d0: 00c00e13 li t3,12
800001d4: 00d00e13 li t3,13
800001d8: 00002083 lw ra,0(zero) # 0 <trap_entry-0x80000020>
800001dc <unalignedPcA>:
800001dc: 0020006f j 800001de <unalignedPcA+0x2>
800001e0: 00002083 lw ra,0(zero) # 0 <trap_entry-0x80000020>
800001e4: 00e00e13 li t3,14
800001e8: 20200073 hret
800001ec: 00f00e13 li t3,15
800001f0: f01000b7 lui ra,0xf0100
800001f4: f6008093 addi ra,ra,-160 # f00fff60 <unalignedPcA+0x700ffd84>
800001f8: 0000a103 lw sp,0(ra)
800001fc: 01000e13 li t3,16
80000200: 0020a023 sw sp,0(ra)
80000204: 01100e13 li t3,17
80000208: 00008067 ret
...

View File

@ -1,27 +1,37 @@
:0200000480007A
:1000000071A00100130000001300000013000000A5
:100000006F004009130000001300000013000000FF
:100010001300000013000000130000001300000094
:10002000732E2034631C0E00130FC0FFF32E103408
:10003000B3FEEE01910E73901E3421A8B70E00801E
:10004000337FDE0163170F00F32E1034910E73908F
:100050001E34B70E0080938E3E006397CE01373C6E
:1000600001F0814C23209C01B70E0080938E7E000E
:100070006394CE0173504030B70E0080938EBE0063
:100080006394CE017350403073002030054E7300EE
:100090000000094EA14273A00230A1427390423089
:1000A000373C01F0854C23209C0101000100010038
:1000B0000100010001000100010001000100010038
:1000C00001000D4E930200087390423001000100C0
:1000D00001000100010001000100114EB7120000F3
:1000E0009382028073904230010001000100010000
:1000F000010001000100154EB70110F0938101F4D9
:1001000003A2010083A241001302F23F23A4410095
:1001100023A65100194E13020008731042301D4EE1
:1001200073005010214E854123A04100254E23909D
:100130004100294E03A201002D4E03920100314ED1
:10014000354E8320000083200000394E73002020AC
:100150003D4EB70010F0938000F603A10000414E21
:1001600023A02000454E8280000000000000000017
:10017000000000000000000000000000000000007F
:040000058000008CEB
:10002000732E2034631E0E00130FC0FFF32E103406
:10003000B3FEEE01938E4E0073901E346F00C0012C
:10004000B70E0080337FDE0163180F00F32E1034EB
:10005000938E4E0073901E34B70E0080938E3E0038
:100060006398CE01373C01F0930C000023209C01E3
:10007000B70E0080938E7E006394CE0173504030A3
:10008000B70E0080938EBE006394CE017350403053
:1000900073002030130E100073000000130E2000B8
:1000A0009302800073A0023093028000739042306C
:1000B000373C01F0930C100023209C01130000003A
:1000C00013000000130000001300000013000000E4
:1000D00013000000130000001300000013000000D4
:1000E000130000001300000013000000130E300086
:1000F00093020008739042301300000013000000C8
:1001000013000000130000001300000013000000A3
:1001100013000000130E4000B7120000938202800B
:100120007390423013000000130000001300000021
:100130001300000013000000130000001300000073
:10014000130E5000B70110F0938101F403A20100D7
:1001500083A241001302F23F23A4410023A65100D1
:100160001300000013000000130000001300000043
:100170001300000013000000130000001300000033
:100180001300000013000000130000001300000023
:100190001300000013000000130E6000130200089B
:1001A00073104230130E700073005010130E800055
:1001B0009301100023A04100130E900023904100F2
:1001C000130EA00003A20100130EB0000392010061
:1001D000130EC000130ED000832000006F0020001B
:1001E00083200000130EE00073002020130EF000A7
:1001F000B70010F0938000F603A10000130E000179
:1002000023A02000130E10016780000000000000F2
:1002100000000000000000000000000000000000DE
:0400000580000094E3
:00000001FF

View File

@ -102,6 +102,20 @@ _start:
addi x4, x4, 1023
sw x4, 8(x3)
sw x5, 12(x3)
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
li x28, 6
li x4, 0x080
csrw mie,x4