Fix MMU MPRV, Fix emulator nested exception

This commit is contained in:
Dolu1990 2019-03-27 22:58:30 +01:00
parent 0bed511a6c
commit ac06111163
6 changed files with 624 additions and 608 deletions

View File

@ -6,13 +6,13 @@ Disassembly of section .init:
80000000 <_start>:
80000000: 00001117 auipc sp,0x1
80000004: 00010113 mv sp,sp
80000004: 03010113 addi sp,sp,48 # 80001030 <_sp>
80000008: 00000517 auipc a0,0x0
8000000c: 78450513 addi a0,a0,1924 # 8000078c <__init_array_end>
8000000c: 7b050513 addi a0,a0,1968 # 800007b8 <__init_array_end>
80000010: 00000597 auipc a1,0x0
80000014: 77c58593 addi a1,a1,1916 # 8000078c <__init_array_end>
80000018: 00000617 auipc a2,0x0
8000001c: 7e860613 addi a2,a2,2024 # 80000800 <__bss_start>
80000014: 7a858593 addi a1,a1,1960 # 800007b8 <__init_array_end>
80000018: 00001617 auipc a2,0x1
8000001c: 81860613 addi a2,a2,-2024 # 80000830 <__bss_start>
80000020: 00c5fc63 bleu a2,a1,80000038 <_start+0x38>
80000024: 00052283 lw t0,0(a0)
80000028: 0055a023 sw t0,0(a1)
@ -20,15 +20,15 @@ Disassembly of section .init:
80000030: 00458593 addi a1,a1,4
80000034: fec5e8e3 bltu a1,a2,80000024 <_start+0x24>
80000038: 00000517 auipc a0,0x0
8000003c: 7c850513 addi a0,a0,1992 # 80000800 <__bss_start>
8000003c: 7f850513 addi a0,a0,2040 # 80000830 <__bss_start>
80000040: 00000597 auipc a1,0x0
80000044: 7c058593 addi a1,a1,1984 # 80000800 <__bss_start>
80000044: 7f058593 addi a1,a1,2032 # 80000830 <__bss_start>
80000048: 00b57863 bleu a1,a0,80000058 <_start+0x58>
8000004c: 00052023 sw zero,0(a0)
80000050: 00450513 addi a0,a0,4
80000054: feb56ce3 bltu a0,a1,8000004c <_start+0x4c>
80000058: 69c000ef jal ra,800006f4 <__libc_init_array>
8000005c: 128000ef jal ra,80000184 <init>
80000058: 6c8000ef jal ra,80000720 <__libc_init_array>
8000005c: 120000ef jal ra,8000017c <init>
80000060: 00000097 auipc ra,0x0
80000064: 01408093 addi ra,ra,20 # 80000074 <done>
80000068: 00000513 li a0,0
@ -43,484 +43,495 @@ Disassembly of section .init:
8000007c <trapEntry>:
8000007c: 34011173 csrrw sp,mscratch,sp
80000080: 00012023 sw zero,0(sp) # 80001000 <_sp>
80000084: 00112223 sw ra,4(sp)
80000088: 00312623 sw gp,12(sp)
8000008c: 00412823 sw tp,16(sp)
80000090: 00512a23 sw t0,20(sp)
80000094: 00612c23 sw t1,24(sp)
80000098: 00712e23 sw t2,28(sp)
8000009c: 02812023 sw s0,32(sp)
800000a0: 02912223 sw s1,36(sp)
800000a4: 02a12423 sw a0,40(sp)
800000a8: 02b12623 sw a1,44(sp)
800000ac: 02c12823 sw a2,48(sp)
800000b0: 02d12a23 sw a3,52(sp)
800000b4: 02e12c23 sw a4,56(sp)
800000b8: 02f12e23 sw a5,60(sp)
800000bc: 05012023 sw a6,64(sp)
800000c0: 05112223 sw a7,68(sp)
800000c4: 05212423 sw s2,72(sp)
800000c8: 05312623 sw s3,76(sp)
800000cc: 05412823 sw s4,80(sp)
800000d0: 05512a23 sw s5,84(sp)
800000d4: 05612c23 sw s6,88(sp)
800000d8: 05712e23 sw s7,92(sp)
800000dc: 07812023 sw s8,96(sp)
800000e0: 07912223 sw s9,100(sp)
800000e4: 07a12423 sw s10,104(sp)
800000e8: 07b12623 sw s11,108(sp)
800000ec: 07c12823 sw t3,112(sp)
800000f0: 07d12a23 sw t4,116(sp)
800000f4: 07e12c23 sw t5,120(sp)
800000f8: 07f12e23 sw t6,124(sp)
800000fc: 1ec000ef jal ra,800002e8 <trap>
80000100: 00012003 lw zero,0(sp)
80000104: 00412083 lw ra,4(sp)
80000108: 00c12183 lw gp,12(sp)
8000010c: 01012203 lw tp,16(sp)
80000110: 01412283 lw t0,20(sp)
80000114: 01812303 lw t1,24(sp)
80000118: 01c12383 lw t2,28(sp)
8000011c: 02012403 lw s0,32(sp)
80000120: 02412483 lw s1,36(sp)
80000124: 02812503 lw a0,40(sp)
80000128: 02c12583 lw a1,44(sp)
8000012c: 03012603 lw a2,48(sp)
80000130: 03412683 lw a3,52(sp)
80000134: 03812703 lw a4,56(sp)
80000138: 03c12783 lw a5,60(sp)
8000013c: 04012803 lw a6,64(sp)
80000140: 04412883 lw a7,68(sp)
80000144: 04812903 lw s2,72(sp)
80000148: 04c12983 lw s3,76(sp)
8000014c: 05012a03 lw s4,80(sp)
80000150: 05412a83 lw s5,84(sp)
80000154: 05812b03 lw s6,88(sp)
80000158: 05c12b83 lw s7,92(sp)
8000015c: 06012c03 lw s8,96(sp)
80000160: 06412c83 lw s9,100(sp)
80000164: 06812d03 lw s10,104(sp)
80000168: 06c12d83 lw s11,108(sp)
8000016c: 07012e03 lw t3,112(sp)
80000170: 07412e83 lw t4,116(sp)
80000174: 07812f03 lw t5,120(sp)
80000178: 07c12f83 lw t6,124(sp)
8000017c: 34011173 csrrw sp,mscratch,sp
80000180: 30200073 mret
80000080: 00112223 sw ra,4(sp)
80000084: 00312623 sw gp,12(sp)
80000088: 00412823 sw tp,16(sp)
8000008c: 00512a23 sw t0,20(sp)
80000090: 00612c23 sw t1,24(sp)
80000094: 00712e23 sw t2,28(sp)
80000098: 02812023 sw s0,32(sp)
8000009c: 02912223 sw s1,36(sp)
800000a0: 02a12423 sw a0,40(sp)
800000a4: 02b12623 sw a1,44(sp)
800000a8: 02c12823 sw a2,48(sp)
800000ac: 02d12a23 sw a3,52(sp)
800000b0: 02e12c23 sw a4,56(sp)
800000b4: 02f12e23 sw a5,60(sp)
800000b8: 05012023 sw a6,64(sp)
800000bc: 05112223 sw a7,68(sp)
800000c0: 05212423 sw s2,72(sp)
800000c4: 05312623 sw s3,76(sp)
800000c8: 05412823 sw s4,80(sp)
800000cc: 05512a23 sw s5,84(sp)
800000d0: 05612c23 sw s6,88(sp)
800000d4: 05712e23 sw s7,92(sp)
800000d8: 07812023 sw s8,96(sp)
800000dc: 07912223 sw s9,100(sp)
800000e0: 07a12423 sw s10,104(sp)
800000e4: 07b12623 sw s11,108(sp)
800000e8: 07c12823 sw t3,112(sp)
800000ec: 07d12a23 sw t4,116(sp)
800000f0: 07e12c23 sw t5,120(sp)
800000f4: 07f12e23 sw t6,124(sp)
800000f8: 1f4000ef jal ra,800002ec <trap>
800000fc: 00412083 lw ra,4(sp)
80000100: 00c12183 lw gp,12(sp)
80000104: 01012203 lw tp,16(sp)
80000108: 01412283 lw t0,20(sp)
8000010c: 01812303 lw t1,24(sp)
80000110: 01c12383 lw t2,28(sp)
80000114: 02012403 lw s0,32(sp)
80000118: 02412483 lw s1,36(sp)
8000011c: 02812503 lw a0,40(sp)
80000120: 02c12583 lw a1,44(sp)
80000124: 03012603 lw a2,48(sp)
80000128: 03412683 lw a3,52(sp)
8000012c: 03812703 lw a4,56(sp)
80000130: 03c12783 lw a5,60(sp)
80000134: 04012803 lw a6,64(sp)
80000138: 04412883 lw a7,68(sp)
8000013c: 04812903 lw s2,72(sp)
80000140: 04c12983 lw s3,76(sp)
80000144: 05012a03 lw s4,80(sp)
80000148: 05412a83 lw s5,84(sp)
8000014c: 05812b03 lw s6,88(sp)
80000150: 05c12b83 lw s7,92(sp)
80000154: 06012c03 lw s8,96(sp)
80000158: 06412c83 lw s9,100(sp)
8000015c: 06812d03 lw s10,104(sp)
80000160: 06c12d83 lw s11,108(sp)
80000164: 07012e03 lw t3,112(sp)
80000168: 07412e83 lw t4,116(sp)
8000016c: 07812f03 lw t5,120(sp)
80000170: 07c12f83 lw t6,124(sp)
80000174: 34011173 csrrw sp,mscratch,sp
80000178: 30200073 mret
Disassembly of section .text:
80000184 <init>:
80000184: 800007b7 lui a5,0x80000
80000188: 07c78793 addi a5,a5,124 # 8000007c <_sp+0xfffff07c>
8000018c: 30579073 csrw mtvec,a5
80000190: 800017b7 lui a5,0x80001
80000194: f8078793 addi a5,a5,-128 # 80000f80 <_sp+0xffffff80>
80000198: 34079073 csrw mscratch,a5
8000019c: 000017b7 lui a5,0x1
800001a0: 88078793 addi a5,a5,-1920 # 880 <__stack_size+0x80>
800001a4: 30079073 csrw mstatus,a5
800001a8: 30405073 csrwi mie,0
800001ac: c00007b7 lui a5,0xc0000
800001b0: 34179073 csrw mepc,a5
800001b4: 0000b7b7 lui a5,0xb
800001b8: 10078793 addi a5,a5,256 # b100 <__stack_size+0xa900>
800001bc: 30279073 csrw medeleg,a5
800001c0: 02000793 li a5,32
800001c4: 30379073 csrw mideleg,a5
800001c8: 14305073 csrwi sbadaddr,0
800001cc: 00008067 ret
8000017c <init>:
8000017c: 800007b7 lui a5,0x80000
80000180: 07c78793 addi a5,a5,124 # 8000007c <_sp+0xfffff04c>
80000184: 30579073 csrw mtvec,a5
80000188: 800017b7 lui a5,0x80001
8000018c: fb078793 addi a5,a5,-80 # 80000fb0 <_sp+0xffffff80>
80000190: 34079073 csrw mscratch,a5
80000194: 000017b7 lui a5,0x1
80000198: 88078793 addi a5,a5,-1920 # 880 <__stack_size+0x80>
8000019c: 30079073 csrw mstatus,a5
800001a0: 30405073 csrwi mie,0
800001a4: c00007b7 lui a5,0xc0000
800001a8: 34179073 csrw mepc,a5
800001ac: 0000b7b7 lui a5,0xb
800001b0: 10078793 addi a5,a5,256 # b100 <__stack_size+0xa900>
800001b4: 30279073 csrw medeleg,a5
800001b8: 02000793 li a5,32
800001bc: 30379073 csrw mideleg,a5
800001c0: 14305073 csrwi sbadaddr,0
800001c4: 00008067 ret
800001d0 <readRegister>:
800001d0: 800017b7 lui a5,0x80001
800001d4: f8078793 addi a5,a5,-128 # 80000f80 <_sp+0xffffff80>
800001d8: 00251513 slli a0,a0,0x2
800001dc: 00f50533 add a0,a0,a5
800001e0: 00052503 lw a0,0(a0)
800001e4: 00008067 ret
800001c8 <readRegister>:
800001c8: 800017b7 lui a5,0x80001
800001cc: fb078793 addi a5,a5,-80 # 80000fb0 <_sp+0xffffff80>
800001d0: 00251513 slli a0,a0,0x2
800001d4: 00f50533 add a0,a0,a5
800001d8: 00052503 lw a0,0(a0)
800001dc: 00008067 ret
800001e8 <writeRegister>:
800001e8: 800017b7 lui a5,0x80001
800001ec: 00251513 slli a0,a0,0x2
800001f0: f8078793 addi a5,a5,-128 # 80000f80 <_sp+0xffffff80>
800001f4: 00f50533 add a0,a0,a5
800001f8: 00b52023 sw a1,0(a0)
800001fc: 00008067 ret
800001e0 <writeRegister>:
800001e0: 800017b7 lui a5,0x80001
800001e4: 00251513 slli a0,a0,0x2
800001e8: fb078793 addi a5,a5,-80 # 80000fb0 <_sp+0xffffff80>
800001ec: 00f50533 add a0,a0,a5
800001f0: 00b52023 sw a1,0(a0)
800001f4: 00008067 ret
80000200 <redirectTrap>:
80000200: ff010113 addi sp,sp,-16
80000204: 00112623 sw ra,12(sp)
80000208: 4b4000ef jal ra,800006bc <stopSim>
8000020c: 343027f3 csrr a5,mbadaddr
80000210: 14379073 csrw sbadaddr,a5
80000214: 341027f3 csrr a5,mepc
80000218: 14179073 csrw sepc,a5
8000021c: 342027f3 csrr a5,mcause
80000220: 14279073 csrw scause,a5
80000224: 105027f3 csrr a5,stvec
80000228: 34179073 csrw mepc,a5
8000022c: 00c12083 lw ra,12(sp)
80000230: 01010113 addi sp,sp,16
80000234: 00008067 ret
800001f8 <redirectTrap>:
800001f8: ff010113 addi sp,sp,-16
800001fc: 00112623 sw ra,12(sp)
80000200: 4e8000ef jal ra,800006e8 <stopSim>
80000204: 343027f3 csrr a5,mbadaddr
80000208: 14379073 csrw sbadaddr,a5
8000020c: 341027f3 csrr a5,mepc
80000210: 14179073 csrw sepc,a5
80000214: 342027f3 csrr a5,mcause
80000218: 14279073 csrw scause,a5
8000021c: 105027f3 csrr a5,stvec
80000220: 34179073 csrw mepc,a5
80000224: 00c12083 lw ra,12(sp)
80000228: 01010113 addi sp,sp,16
8000022c: 00008067 ret
80000238 <emulationTrapToSupervisorTrap>:
80000238: 343027f3 csrr a5,mbadaddr
8000023c: 14379073 csrw sbadaddr,a5
80000240: 342027f3 csrr a5,mcause
80000244: 14279073 csrw scause,a5
80000248: 14151073 csrw sepc,a0
8000024c: 105027f3 csrr a5,stvec
80000250: 34179073 csrw mepc,a5
80000254: 10000793 li a5,256
80000258: 1007b073 csrc sstatus,a5
8000025c: 0035d593 srli a1,a1,0x3
80000260: 1005f593 andi a1,a1,256
80000264: 1005a073 csrs sstatus,a1
80000268: 000027b7 lui a5,0x2
8000026c: 80078793 addi a5,a5,-2048 # 1800 <__stack_size+0x1000>
80000270: 3007b073 csrc mstatus,a5
80000274: 000087b7 lui a5,0x8
80000278: 08078793 addi a5,a5,128 # 8080 <__stack_size+0x7880>
8000027c: 3007a073 csrs mstatus,a5
80000280: 00008067 ret
80000230 <emulationTrapToSupervisorTrap>:
80000230: 800007b7 lui a5,0x80000
80000234: 07c78793 addi a5,a5,124 # 8000007c <_sp+0xfffff04c>
80000238: 30579073 csrw mtvec,a5
8000023c: 343027f3 csrr a5,mbadaddr
80000240: 14379073 csrw sbadaddr,a5
80000244: 342027f3 csrr a5,mcause
80000248: 14279073 csrw scause,a5
8000024c: 14151073 csrw sepc,a0
80000250: 105027f3 csrr a5,stvec
80000254: 34179073 csrw mepc,a5
80000258: 10000793 li a5,256
8000025c: 1007b073 csrc sstatus,a5
80000260: 0035d593 srli a1,a1,0x3
80000264: 1005f593 andi a1,a1,256
80000268: 1005a073 csrs sstatus,a1
8000026c: 000027b7 lui a5,0x2
80000270: 80078793 addi a5,a5,-2048 # 1800 <__stack_size+0x1000>
80000274: 3007b073 csrc mstatus,a5
80000278: 000087b7 lui a5,0x8
8000027c: 08078793 addi a5,a5,128 # 8080 <__stack_size+0x7880>
80000280: 3007a073 csrs mstatus,a5
80000284: 00008067 ret
80000284 <readWord>:
80000284: 00020737 lui a4,0x20
80000288: 30072073 csrs mstatus,a4
8000028c: 00000717 auipc a4,0x0
80000290: 01870713 addi a4,a4,24 # 800002a4 <readWord+0x20>
80000294: 34171073 csrw mepc,a4
80000298: 00100693 li a3,1
8000029c: 00052783 lw a5,0(a0)
800002a0: 00000693 li a3,0
800002a4: 00020737 lui a4,0x20
800002a8: 30073073 csrc mstatus,a4
800002ac: 00068513 mv a0,a3
800002b0: 00f5a023 sw a5,0(a1) # 81000000 <_sp+0xfff000>
800002b4: 00008067 ret
80000288 <readWord>:
80000288: 00020737 lui a4,0x20
8000028c: 30072073 csrs mstatus,a4
80000290: 00000717 auipc a4,0x0
80000294: 01870713 addi a4,a4,24 # 800002a8 <readWord+0x20>
80000298: 30571073 csrw mtvec,a4
8000029c: 00100693 li a3,1
800002a0: 00052783 lw a5,0(a0)
800002a4: 00000693 li a3,0
800002a8: 00020737 lui a4,0x20
800002ac: 30073073 csrc mstatus,a4
800002b0: 00068513 mv a0,a3
800002b4: 00f5a023 sw a5,0(a1) # 81000000 <_sp+0xffefd0>
800002b8: 00008067 ret
800002b8 <writeWord>:
800002b8: 00020737 lui a4,0x20
800002bc: 30072073 csrs mstatus,a4
800002c0: 00000717 auipc a4,0x0
800002c4: 01870713 addi a4,a4,24 # 800002d8 <writeWord+0x20>
800002c8: 34171073 csrw mepc,a4
800002cc: 00100793 li a5,1
800002d0: 00b52023 sw a1,0(a0)
800002d4: 00000793 li a5,0
800002d8: 00020737 lui a4,0x20
800002dc: 30073073 csrc mstatus,a4
800002e0: 00078513 mv a0,a5
800002e4: 00008067 ret
800002bc <writeWord>:
800002bc: 00020737 lui a4,0x20
800002c0: 30072073 csrs mstatus,a4
800002c4: 00000717 auipc a4,0x0
800002c8: 01870713 addi a4,a4,24 # 800002dc <writeWord+0x20>
800002cc: 30571073 csrw mtvec,a4
800002d0: 00100793 li a5,1
800002d4: 00b52023 sw a1,0(a0)
800002d8: 00000793 li a5,0
800002dc: 00020737 lui a4,0x20
800002e0: 30073073 csrc mstatus,a4
800002e4: 00078513 mv a0,a5
800002e8: 00008067 ret
800002e8 <trap>:
800002e8: fe010113 addi sp,sp,-32
800002ec: 00112e23 sw ra,28(sp)
800002f0: 00812c23 sw s0,24(sp)
800002f4: 00912a23 sw s1,20(sp)
800002f8: 01212823 sw s2,16(sp)
800002fc: 01312623 sw s3,12(sp)
80000300: 342027f3 csrr a5,mcause
80000304: 1407ce63 bltz a5,80000460 <trap+0x178>
80000308: 00200713 li a4,2
8000030c: 04e78463 beq a5,a4,80000354 <trap+0x6c>
80000310: 00900693 li a3,9
80000314: 10d79663 bne a5,a3,80000420 <trap+0x138>
80000318: 800017b7 lui a5,0x80001
8000031c: 00078793 mv a5,a5
80000320: fc47a683 lw a3,-60(a5) # 80000fc4 <_sp+0xffffffc4>
80000324: 00100613 li a2,1
80000328: fa87a503 lw a0,-88(a5)
8000032c: 1ec68663 beq a3,a2,80000518 <trap+0x230>
80000330: 22e68463 beq a3,a4,80000558 <trap+0x270>
80000334: 1e068e63 beqz a3,80000530 <trap+0x248>
80000338: 01812403 lw s0,24(sp)
8000033c: 01c12083 lw ra,28(sp)
80000340: 01412483 lw s1,20(sp)
80000344: 01012903 lw s2,16(sp)
80000348: 00c12983 lw s3,12(sp)
8000034c: 02010113 addi sp,sp,32
80000350: 36c0006f j 800006bc <stopSim>
80000354: 341024f3 csrr s1,mepc
80000358: 300025f3 csrr a1,mstatus
8000035c: 34302473 csrr s0,mbadaddr
80000360: 02f00613 li a2,47
80000364: 07f47693 andi a3,s0,127
80000368: 00c45713 srli a4,s0,0xc
8000036c: 12c68663 beq a3,a2,80000498 <trap+0x1b0>
80000370: 07300613 li a2,115
80000374: 0ac69663 bne a3,a2,80000420 <trap+0x138>
80000378: 00377713 andi a4,a4,3
8000037c: 24f70063 beq a4,a5,800005bc <trap+0x2d4>
80000380: 00300793 li a5,3
80000384: 22f70c63 beq a4,a5,800005bc <trap+0x2d4>
80000388: 00100993 li s3,1
8000038c: 03370463 beq a4,s3,800003b4 <trap+0xcc>
80000390: 32c000ef jal ra,800006bc <stopSim>
80000394: 343027f3 csrr a5,mbadaddr
80000398: 14379073 csrw sbadaddr,a5
8000039c: 341027f3 csrr a5,mepc
800003a0: 14179073 csrw sepc,a5
800003a4: 342027f3 csrr a5,mcause
800003a8: 14279073 csrw scause,a5
800003ac: 105027f3 csrr a5,stvec
800003b0: 34179073 csrw mepc,a5
800003b4: 000017b7 lui a5,0x1
800003b8: 01445713 srli a4,s0,0x14
800003bc: c0178693 addi a3,a5,-1023 # c01 <__stack_size+0x401>
800003c0: 2ed70863 beq a4,a3,800006b0 <trap+0x3c8>
800003c4: c8178793 addi a5,a5,-895
800003c8: 2cf71063 bne a4,a5,80000688 <trap+0x3a0>
800003cc: 308000ef jal ra,800006d4 <rdtimeh>
800003d0: 00050913 mv s2,a0
800003d4: 02098463 beqz s3,800003fc <trap+0x114>
800003d8: 2e4000ef jal ra,800006bc <stopSim>
800003dc: 343027f3 csrr a5,mbadaddr
800003e0: 14379073 csrw sbadaddr,a5
800003e4: 341027f3 csrr a5,mepc
800003e8: 14179073 csrw sepc,a5
800003ec: 342027f3 csrr a5,mcause
800003f0: 14279073 csrw scause,a5
800003f4: 105027f3 csrr a5,stvec
800003f8: 34179073 csrw mepc,a5
800003fc: 00545413 srli s0,s0,0x5
80000400: 800017b7 lui a5,0x80001
80000404: 07c47413 andi s0,s0,124
80000408: f8078793 addi a5,a5,-128 # 80000f80 <_sp+0xffffff80>
8000040c: 00f40433 add s0,s0,a5
80000410: 01242023 sw s2,0(s0)
80000414: 00448493 addi s1,s1,4
80000418: 34149073 csrw mepc,s1
8000041c: 0280006f j 80000444 <trap+0x15c>
80000420: 29c000ef jal ra,800006bc <stopSim>
80000424: 343027f3 csrr a5,mbadaddr
80000428: 14379073 csrw sbadaddr,a5
8000042c: 341027f3 csrr a5,mepc
80000430: 14179073 csrw sepc,a5
80000434: 342027f3 csrr a5,mcause
80000438: 14279073 csrw scause,a5
8000043c: 105027f3 csrr a5,stvec
80000440: 34179073 csrw mepc,a5
80000444: 01c12083 lw ra,28(sp)
80000448: 01812403 lw s0,24(sp)
8000044c: 01412483 lw s1,20(sp)
80000450: 01012903 lw s2,16(sp)
80000454: 00c12983 lw s3,12(sp)
80000458: 02010113 addi sp,sp,32
8000045c: 00008067 ret
80000460: 0ff7f793 andi a5,a5,255
80000464: 00700713 li a4,7
80000468: fae79ce3 bne a5,a4,80000420 <trap+0x138>
8000046c: 02000793 li a5,32
80000470: 1447a073 csrs sip,a5
80000474: 08000793 li a5,128
80000478: 3047b073 csrc mie,a5
8000047c: 01c12083 lw ra,28(sp)
80000480: 01812403 lw s0,24(sp)
80000484: 01412483 lw s1,20(sp)
80000488: 01012903 lw s2,16(sp)
8000048c: 00c12983 lw s3,12(sp)
80000490: 02010113 addi sp,sp,32
80000494: 00008067 ret
80000498: 00777713 andi a4,a4,7
8000049c: f8f712e3 bne a4,a5,80000420 <trap+0x138>
800004a0: 00d45713 srli a4,s0,0xd
800004a4: 01245793 srli a5,s0,0x12
800004a8: 800016b7 lui a3,0x80001
800004ac: f8068693 addi a3,a3,-128 # 80000f80 <_sp+0xffffff80>
800004b0: 07c77713 andi a4,a4,124
800004b4: 07c7f793 andi a5,a5,124
800004b8: 00d70733 add a4,a4,a3
800004bc: 00d787b3 add a5,a5,a3
800004c0: 00072703 lw a4,0(a4) # 20000 <__stack_size+0x1f800>
800004c4: 0007a603 lw a2,0(a5)
800004c8: 00020537 lui a0,0x20
800004cc: 30052073 csrs mstatus,a0
800004d0: 00000517 auipc a0,0x0
800004d4: 01850513 addi a0,a0,24 # 800004e8 <trap+0x200>
800004d8: 34151073 csrw mepc,a0
800004dc: 00100793 li a5,1
800004e0: 00072803 lw a6,0(a4)
800004e4: 00000793 li a5,0
800004e8: 00020537 lui a0,0x20
800004ec: 30053073 csrc mstatus,a0
800004f0: 08079063 bnez a5,80000570 <trap+0x288>
800004f4: 01b45793 srli a5,s0,0x1b
800004f8: 01c00513 li a0,28
800004fc: f2f562e3 bltu a0,a5,80000420 <trap+0x138>
80000500: 80000537 lui a0,0x80000
80000504: 00279793 slli a5,a5,0x2
80000508: 78c50513 addi a0,a0,1932 # 8000078c <_sp+0xfffff78c>
8000050c: 00a787b3 add a5,a5,a0
80000510: 0007a783 lw a5,0(a5)
80000514: 00078067 jr a5
80000518: 0ff57513 andi a0,a0,255
8000051c: 1a8000ef jal ra,800006c4 <putC>
80000520: 341027f3 csrr a5,mepc
80000524: 00478793 addi a5,a5,4
80000528: 34179073 csrw mepc,a5
8000052c: f19ff06f j 80000444 <trap+0x15c>
80000530: fac7a583 lw a1,-84(a5)
80000534: 1a8000ef jal ra,800006dc <setMachineTimerCmp>
80000538: 08000793 li a5,128
8000053c: 3047a073 csrs mie,a5
80000540: 02000793 li a5,32
80000544: 1447b073 csrc sip,a5
80000548: 341027f3 csrr a5,mepc
8000054c: 00478793 addi a5,a5,4
80000550: 34179073 csrw mepc,a5
80000554: ef1ff06f j 80000444 <trap+0x15c>
80000558: fff00713 li a4,-1
8000055c: fae7a423 sw a4,-88(a5)
80000560: 341027f3 csrr a5,mepc
80000564: 00478793 addi a5,a5,4
80000568: 34179073 csrw mepc,a5
8000056c: ed9ff06f j 80000444 <trap+0x15c>
80000570: 343027f3 csrr a5,mbadaddr
80000574: 14379073 csrw sbadaddr,a5
80000578: 342027f3 csrr a5,mcause
8000057c: 14279073 csrw scause,a5
80000580: 14149073 csrw sepc,s1
80000584: 105027f3 csrr a5,stvec
80000588: 34179073 csrw mepc,a5
8000058c: 10000793 li a5,256
80000590: 1007b073 csrc sstatus,a5
80000594: 0035d593 srli a1,a1,0x3
80000598: 1005f593 andi a1,a1,256
8000059c: 1005a073 csrs sstatus,a1
800005a0: 000027b7 lui a5,0x2
800005a4: 80078793 addi a5,a5,-2048 # 1800 <__stack_size+0x1000>
800005a8: 3007b073 csrc mstatus,a5
800005ac: 000087b7 lui a5,0x8
800005b0: 08078793 addi a5,a5,128 # 8080 <__stack_size+0x7880>
800005b4: 3007a073 csrs mstatus,a5
800005b8: e8dff06f j 80000444 <trap+0x15c>
800005bc: 00f45993 srli s3,s0,0xf
800005c0: 01f9f993 andi s3,s3,31
800005c4: 013039b3 snez s3,s3
800005c8: dedff06f j 800003b4 <trap+0xcc>
800005cc: 01060633 add a2,a2,a6
800005d0: 00545413 srli s0,s0,0x5
800005d4: 07c47413 andi s0,s0,124
800005d8: 00d406b3 add a3,s0,a3
800005dc: 0106a023 sw a6,0(a3)
800005e0: 000206b7 lui a3,0x20
800005e4: 3006a073 csrs mstatus,a3
800005e8: 00000697 auipc a3,0x0
800005ec: 01868693 addi a3,a3,24 # 80000600 <trap+0x318>
800005f0: 34169073 csrw mepc,a3
800005f4: 00100793 li a5,1
800005f8: 00c72023 sw a2,0(a4)
800005fc: 00000793 li a5,0
80000600: 000206b7 lui a3,0x20
80000604: 3006b073 csrc mstatus,a3
80000608: e00786e3 beqz a5,80000414 <trap+0x12c>
8000060c: 343027f3 csrr a5,mbadaddr
80000610: 14379073 csrw sbadaddr,a5
80000614: 342027f3 csrr a5,mcause
80000618: 14279073 csrw scause,a5
8000061c: 14149073 csrw sepc,s1
80000620: 105027f3 csrr a5,stvec
80000624: 34179073 csrw mepc,a5
80000628: 10000793 li a5,256
8000062c: 1007b073 csrc sstatus,a5
80000630: 0035d793 srli a5,a1,0x3
80000634: 1007f793 andi a5,a5,256
80000638: 1007a073 csrs sstatus,a5
8000063c: f65ff06f j 800005a0 <trap+0x2b8>
80000640: f90678e3 bleu a6,a2,800005d0 <trap+0x2e8>
80000644: 00080613 mv a2,a6
80000648: f89ff06f j 800005d0 <trap+0x2e8>
8000064c: 01066633 or a2,a2,a6
80000650: f81ff06f j 800005d0 <trap+0x2e8>
80000654: 01064633 xor a2,a2,a6
80000658: f79ff06f j 800005d0 <trap+0x2e8>
8000065c: f6c87ae3 bleu a2,a6,800005d0 <trap+0x2e8>
800002ec <trap>:
800002ec: fe010113 addi sp,sp,-32
800002f0: 00112e23 sw ra,28(sp)
800002f4: 00812c23 sw s0,24(sp)
800002f8: 00912a23 sw s1,20(sp)
800002fc: 01212823 sw s2,16(sp)
80000300: 01312623 sw s3,12(sp)
80000304: 342027f3 csrr a5,mcause
80000308: 1407ce63 bltz a5,80000464 <trap+0x178>
8000030c: 00200713 li a4,2
80000310: 04e78463 beq a5,a4,80000358 <trap+0x6c>
80000314: 00900693 li a3,9
80000318: 10d79663 bne a5,a3,80000424 <trap+0x138>
8000031c: 800017b7 lui a5,0x80001
80000320: 03078793 addi a5,a5,48 # 80001030 <_sp+0x0>
80000324: fc47a683 lw a3,-60(a5)
80000328: 00100613 li a2,1
8000032c: fa87a503 lw a0,-88(a5)
80000330: 1ec68663 beq a3,a2,8000051c <trap+0x230>
80000334: 22e68463 beq a3,a4,8000055c <trap+0x270>
80000338: 1e068e63 beqz a3,80000534 <trap+0x248>
8000033c: 01812403 lw s0,24(sp)
80000340: 01c12083 lw ra,28(sp)
80000344: 01412483 lw s1,20(sp)
80000348: 01012903 lw s2,16(sp)
8000034c: 00c12983 lw s3,12(sp)
80000350: 02010113 addi sp,sp,32
80000354: 3940006f j 800006e8 <stopSim>
80000358: 341024f3 csrr s1,mepc
8000035c: 300025f3 csrr a1,mstatus
80000360: 34302473 csrr s0,mbadaddr
80000364: 02f00613 li a2,47
80000368: 07f47693 andi a3,s0,127
8000036c: 00c45713 srli a4,s0,0xc
80000370: 12c68663 beq a3,a2,8000049c <trap+0x1b0>
80000374: 07300613 li a2,115
80000378: 0ac69663 bne a3,a2,80000424 <trap+0x138>
8000037c: 00377713 andi a4,a4,3
80000380: 24f70663 beq a4,a5,800005cc <trap+0x2e0>
80000384: 00300793 li a5,3
80000388: 24f70263 beq a4,a5,800005cc <trap+0x2e0>
8000038c: 00100993 li s3,1
80000390: 03370463 beq a4,s3,800003b8 <trap+0xcc>
80000394: 354000ef jal ra,800006e8 <stopSim>
80000398: 343027f3 csrr a5,mbadaddr
8000039c: 14379073 csrw sbadaddr,a5
800003a0: 341027f3 csrr a5,mepc
800003a4: 14179073 csrw sepc,a5
800003a8: 342027f3 csrr a5,mcause
800003ac: 14279073 csrw scause,a5
800003b0: 105027f3 csrr a5,stvec
800003b4: 34179073 csrw mepc,a5
800003b8: 000017b7 lui a5,0x1
800003bc: 01445713 srli a4,s0,0x14
800003c0: c0178693 addi a3,a5,-1023 # c01 <__stack_size+0x401>
800003c4: 30d70463 beq a4,a3,800006cc <trap+0x3e0>
800003c8: c8178793 addi a5,a5,-895
800003cc: 2cf71c63 bne a4,a5,800006a4 <trap+0x3b8>
800003d0: 330000ef jal ra,80000700 <rdtimeh>
800003d4: 00050913 mv s2,a0
800003d8: 02098463 beqz s3,80000400 <trap+0x114>
800003dc: 30c000ef jal ra,800006e8 <stopSim>
800003e0: 343027f3 csrr a5,mbadaddr
800003e4: 14379073 csrw sbadaddr,a5
800003e8: 341027f3 csrr a5,mepc
800003ec: 14179073 csrw sepc,a5
800003f0: 342027f3 csrr a5,mcause
800003f4: 14279073 csrw scause,a5
800003f8: 105027f3 csrr a5,stvec
800003fc: 34179073 csrw mepc,a5
80000400: 00545413 srli s0,s0,0x5
80000404: 800017b7 lui a5,0x80001
80000408: fb078793 addi a5,a5,-80 # 80000fb0 <_sp+0xffffff80>
8000040c: 07c47413 andi s0,s0,124
80000410: 00f40433 add s0,s0,a5
80000414: 01242023 sw s2,0(s0)
80000418: 00448493 addi s1,s1,4
8000041c: 34149073 csrw mepc,s1
80000420: 0280006f j 80000448 <trap+0x15c>
80000424: 2c4000ef jal ra,800006e8 <stopSim>
80000428: 343027f3 csrr a5,mbadaddr
8000042c: 14379073 csrw sbadaddr,a5
80000430: 341027f3 csrr a5,mepc
80000434: 14179073 csrw sepc,a5
80000438: 342027f3 csrr a5,mcause
8000043c: 14279073 csrw scause,a5
80000440: 105027f3 csrr a5,stvec
80000444: 34179073 csrw mepc,a5
80000448: 01c12083 lw ra,28(sp)
8000044c: 01812403 lw s0,24(sp)
80000450: 01412483 lw s1,20(sp)
80000454: 01012903 lw s2,16(sp)
80000458: 00c12983 lw s3,12(sp)
8000045c: 02010113 addi sp,sp,32
80000460: 00008067 ret
80000464: 0ff7f793 andi a5,a5,255
80000468: 00700713 li a4,7
8000046c: fae79ce3 bne a5,a4,80000424 <trap+0x138>
80000470: 02000793 li a5,32
80000474: 1447a073 csrs sip,a5
80000478: 08000793 li a5,128
8000047c: 3047b073 csrc mie,a5
80000480: 01c12083 lw ra,28(sp)
80000484: 01812403 lw s0,24(sp)
80000488: 01412483 lw s1,20(sp)
8000048c: 01012903 lw s2,16(sp)
80000490: 00c12983 lw s3,12(sp)
80000494: 02010113 addi sp,sp,32
80000498: 00008067 ret
8000049c: 00777713 andi a4,a4,7
800004a0: f8f712e3 bne a4,a5,80000424 <trap+0x138>
800004a4: 00d45713 srli a4,s0,0xd
800004a8: 01245793 srli a5,s0,0x12
800004ac: 800016b7 lui a3,0x80001
800004b0: fb068693 addi a3,a3,-80 # 80000fb0 <_sp+0xffffff80>
800004b4: 07c77713 andi a4,a4,124
800004b8: 07c7f793 andi a5,a5,124
800004bc: 00d70733 add a4,a4,a3
800004c0: 00d787b3 add a5,a5,a3
800004c4: 00072703 lw a4,0(a4) # 20000 <__stack_size+0x1f800>
800004c8: 0007a603 lw a2,0(a5)
800004cc: 00020537 lui a0,0x20
800004d0: 30052073 csrs mstatus,a0
800004d4: 00000517 auipc a0,0x0
800004d8: 01850513 addi a0,a0,24 # 800004ec <trap+0x200>
800004dc: 30551073 csrw mtvec,a0
800004e0: 00100793 li a5,1
800004e4: 00072803 lw a6,0(a4)
800004e8: 00000793 li a5,0
800004ec: 00020537 lui a0,0x20
800004f0: 30053073 csrc mstatus,a0
800004f4: 08079063 bnez a5,80000574 <trap+0x288>
800004f8: 01b45793 srli a5,s0,0x1b
800004fc: 01c00513 li a0,28
80000500: f2f562e3 bltu a0,a5,80000424 <trap+0x138>
80000504: 80000537 lui a0,0x80000
80000508: 00279793 slli a5,a5,0x2
8000050c: 7b850513 addi a0,a0,1976 # 800007b8 <_sp+0xfffff788>
80000510: 00a787b3 add a5,a5,a0
80000514: 0007a783 lw a5,0(a5)
80000518: 00078067 jr a5
8000051c: 0ff57513 andi a0,a0,255
80000520: 1d0000ef jal ra,800006f0 <putC>
80000524: 341027f3 csrr a5,mepc
80000528: 00478793 addi a5,a5,4
8000052c: 34179073 csrw mepc,a5
80000530: f19ff06f j 80000448 <trap+0x15c>
80000534: fac7a583 lw a1,-84(a5)
80000538: 1d0000ef jal ra,80000708 <setMachineTimerCmp>
8000053c: 08000793 li a5,128
80000540: 3047a073 csrs mie,a5
80000544: 02000793 li a5,32
80000548: 1447b073 csrc sip,a5
8000054c: 341027f3 csrr a5,mepc
80000550: 00478793 addi a5,a5,4
80000554: 34179073 csrw mepc,a5
80000558: ef1ff06f j 80000448 <trap+0x15c>
8000055c: fff00713 li a4,-1
80000560: fae7a423 sw a4,-88(a5)
80000564: 341027f3 csrr a5,mepc
80000568: 00478793 addi a5,a5,4
8000056c: 34179073 csrw mepc,a5
80000570: ed9ff06f j 80000448 <trap+0x15c>
80000574: 800007b7 lui a5,0x80000
80000578: 07c78793 addi a5,a5,124 # 8000007c <_sp+0xfffff04c>
8000057c: 30579073 csrw mtvec,a5
80000580: 343027f3 csrr a5,mbadaddr
80000584: 14379073 csrw sbadaddr,a5
80000588: 342027f3 csrr a5,mcause
8000058c: 14279073 csrw scause,a5
80000590: 14149073 csrw sepc,s1
80000594: 105027f3 csrr a5,stvec
80000598: 34179073 csrw mepc,a5
8000059c: 10000793 li a5,256
800005a0: 1007b073 csrc sstatus,a5
800005a4: 0035d593 srli a1,a1,0x3
800005a8: 1005f593 andi a1,a1,256
800005ac: 1005a073 csrs sstatus,a1
800005b0: 000027b7 lui a5,0x2
800005b4: 80078793 addi a5,a5,-2048 # 1800 <__stack_size+0x1000>
800005b8: 3007b073 csrc mstatus,a5
800005bc: 000087b7 lui a5,0x8
800005c0: 08078793 addi a5,a5,128 # 8080 <__stack_size+0x7880>
800005c4: 3007a073 csrs mstatus,a5
800005c8: e81ff06f j 80000448 <trap+0x15c>
800005cc: 00f45993 srli s3,s0,0xf
800005d0: 01f9f993 andi s3,s3,31
800005d4: 013039b3 snez s3,s3
800005d8: de1ff06f j 800003b8 <trap+0xcc>
800005dc: 01060633 add a2,a2,a6
800005e0: 00545413 srli s0,s0,0x5
800005e4: 07c47413 andi s0,s0,124
800005e8: 00d406b3 add a3,s0,a3
800005ec: 0106a023 sw a6,0(a3)
800005f0: 000207b7 lui a5,0x20
800005f4: 3007a073 csrs mstatus,a5
800005f8: 00000797 auipc a5,0x0
800005fc: 01878793 addi a5,a5,24 # 80000610 <trap+0x324>
80000600: 30579073 csrw mtvec,a5
80000604: 00100693 li a3,1
80000608: 00c72023 sw a2,0(a4)
8000060c: 00000693 li a3,0
80000610: 000207b7 lui a5,0x20
80000614: 3007b073 csrc mstatus,a5
80000618: 800007b7 lui a5,0x80000
8000061c: 07c78793 addi a5,a5,124 # 8000007c <_sp+0xfffff04c>
80000620: 0a068c63 beqz a3,800006d8 <trap+0x3ec>
80000624: 30579073 csrw mtvec,a5
80000628: 343027f3 csrr a5,mbadaddr
8000062c: 14379073 csrw sbadaddr,a5
80000630: 342027f3 csrr a5,mcause
80000634: 14279073 csrw scause,a5
80000638: 14149073 csrw sepc,s1
8000063c: 105027f3 csrr a5,stvec
80000640: 34179073 csrw mepc,a5
80000644: 10000793 li a5,256
80000648: 1007b073 csrc sstatus,a5
8000064c: 0035d793 srli a5,a1,0x3
80000650: 1007f793 andi a5,a5,256
80000654: 1007a073 csrs sstatus,a5
80000658: f59ff06f j 800005b0 <trap+0x2c4>
8000065c: f90672e3 bleu a6,a2,800005e0 <trap+0x2f4>
80000660: 00080613 mv a2,a6
80000664: f6dff06f j 800005d0 <trap+0x2e8>
80000668: f70654e3 ble a6,a2,800005d0 <trap+0x2e8>
80000664: f7dff06f j 800005e0 <trap+0x2f4>
80000668: f6c87ce3 bleu a2,a6,800005e0 <trap+0x2f4>
8000066c: 00080613 mv a2,a6
80000670: f61ff06f j 800005d0 <trap+0x2e8>
80000674: f4c85ee3 ble a2,a6,800005d0 <trap+0x2e8>
80000678: 00080613 mv a2,a6
8000067c: f55ff06f j 800005d0 <trap+0x2e8>
80000680: 01067633 and a2,a2,a6
80000684: f4dff06f j 800005d0 <trap+0x2e8>
80000688: 034000ef jal ra,800006bc <stopSim>
8000068c: 343027f3 csrr a5,mbadaddr
80000690: 14379073 csrw sbadaddr,a5
80000694: 341027f3 csrr a5,mepc
80000698: 14179073 csrw sepc,a5
8000069c: 342027f3 csrr a5,mcause
800006a0: 14279073 csrw scause,a5
800006a4: 105027f3 csrr a5,stvec
800006a8: 34179073 csrw mepc,a5
800006ac: d29ff06f j 800003d4 <trap+0xec>
800006b0: 01c000ef jal ra,800006cc <rdtime>
800006b4: 00050913 mv s2,a0
800006b8: d1dff06f j 800003d4 <trap+0xec>
80000670: f71ff06f j 800005e0 <trap+0x2f4>
80000674: 01066633 or a2,a2,a6
80000678: f69ff06f j 800005e0 <trap+0x2f4>
8000067c: 01064633 xor a2,a2,a6
80000680: f61ff06f j 800005e0 <trap+0x2f4>
80000684: f4c85ee3 ble a2,a6,800005e0 <trap+0x2f4>
80000688: 00080613 mv a2,a6
8000068c: f55ff06f j 800005e0 <trap+0x2f4>
80000690: 01067633 and a2,a2,a6
80000694: f4dff06f j 800005e0 <trap+0x2f4>
80000698: f50654e3 ble a6,a2,800005e0 <trap+0x2f4>
8000069c: 00080613 mv a2,a6
800006a0: f41ff06f j 800005e0 <trap+0x2f4>
800006a4: 044000ef jal ra,800006e8 <stopSim>
800006a8: 343027f3 csrr a5,mbadaddr
800006ac: 14379073 csrw sbadaddr,a5
800006b0: 341027f3 csrr a5,mepc
800006b4: 14179073 csrw sepc,a5
800006b8: 342027f3 csrr a5,mcause
800006bc: 14279073 csrw scause,a5
800006c0: 105027f3 csrr a5,stvec
800006c4: 34179073 csrw mepc,a5
800006c8: d11ff06f j 800003d8 <trap+0xec>
800006cc: 02c000ef jal ra,800006f8 <rdtime>
800006d0: 00050913 mv s2,a0
800006d4: d05ff06f j 800003d8 <trap+0xec>
800006d8: 00448493 addi s1,s1,4
800006dc: 34149073 csrw mepc,s1
800006e0: 30579073 csrw mtvec,a5
800006e4: d65ff06f j 80000448 <trap+0x15c>
800006bc <stopSim>:
800006bc: fe002e23 sw zero,-4(zero) # fffffffc <_sp+0x7fffeffc>
800006c0: 00008067 ret
800006e8 <stopSim>:
800006e8: fe002e23 sw zero,-4(zero) # fffffffc <_sp+0x7fffefcc>
800006ec: 00008067 ret
800006c4 <putC>:
800006c4: fea02c23 sw a0,-8(zero) # fffffff8 <_sp+0x7fffeff8>
800006c8: 00008067 ret
800006f0 <putC>:
800006f0: fea02c23 sw a0,-8(zero) # fffffff8 <_sp+0x7fffefc8>
800006f4: 00008067 ret
800006cc <rdtime>:
800006cc: fe002503 lw a0,-32(zero) # ffffffe0 <_sp+0x7fffefe0>
800006d0: 00008067 ret
800006f8 <rdtime>:
800006f8: fe002503 lw a0,-32(zero) # ffffffe0 <_sp+0x7fffefb0>
800006fc: 00008067 ret
800006d4 <rdtimeh>:
800006d4: fe402503 lw a0,-28(zero) # ffffffe4 <_sp+0x7fffefe4>
800006d8: 00008067 ret
80000700 <rdtimeh>:
80000700: fe402503 lw a0,-28(zero) # ffffffe4 <_sp+0x7fffefb4>
80000704: 00008067 ret
800006dc <setMachineTimerCmp>:
800006dc: fec00793 li a5,-20
800006e0: fff00713 li a4,-1
800006e4: 00e7a023 sw a4,0(a5)
800006e8: fea02423 sw a0,-24(zero) # ffffffe8 <_sp+0x7fffefe8>
800006ec: 00b7a023 sw a1,0(a5)
800006f0: 00008067 ret
80000708 <setMachineTimerCmp>:
80000708: fec00793 li a5,-20
8000070c: fff00713 li a4,-1
80000710: 00e7a023 sw a4,0(a5)
80000714: fea02423 sw a0,-24(zero) # ffffffe8 <_sp+0x7fffefb8>
80000718: 00b7a023 sw a1,0(a5)
8000071c: 00008067 ret
800006f4 <__libc_init_array>:
800006f4: ff010113 addi sp,sp,-16
800006f8: 00812423 sw s0,8(sp)
800006fc: 00912223 sw s1,4(sp)
80000700: 00000417 auipc s0,0x0
80000704: 08c40413 addi s0,s0,140 # 8000078c <__init_array_end>
80000708: 00000497 auipc s1,0x0
8000070c: 08448493 addi s1,s1,132 # 8000078c <__init_array_end>
80000710: 408484b3 sub s1,s1,s0
80000714: 01212023 sw s2,0(sp)
80000718: 00112623 sw ra,12(sp)
8000071c: 4024d493 srai s1,s1,0x2
80000720: 00000913 li s2,0
80000724: 04991063 bne s2,s1,80000764 <__libc_init_array+0x70>
80000728: 00000417 auipc s0,0x0
8000072c: 06440413 addi s0,s0,100 # 8000078c <__init_array_end>
80000730: 00000497 auipc s1,0x0
80000734: 05c48493 addi s1,s1,92 # 8000078c <__init_array_end>
80000738: 408484b3 sub s1,s1,s0
8000073c: 93dff0ef jal ra,80000078 <_init>
80000740: 4024d493 srai s1,s1,0x2
80000744: 00000913 li s2,0
80000748: 02991863 bne s2,s1,80000778 <__libc_init_array+0x84>
8000074c: 00c12083 lw ra,12(sp)
80000750: 00812403 lw s0,8(sp)
80000754: 00412483 lw s1,4(sp)
80000758: 00012903 lw s2,0(sp)
8000075c: 01010113 addi sp,sp,16
80000760: 00008067 ret
80000764: 00042783 lw a5,0(s0)
80000768: 00190913 addi s2,s2,1
8000076c: 00440413 addi s0,s0,4
80000770: 000780e7 jalr a5
80000774: fb1ff06f j 80000724 <__libc_init_array+0x30>
80000778: 00042783 lw a5,0(s0)
8000077c: 00190913 addi s2,s2,1
80000780: 00440413 addi s0,s0,4
80000784: 000780e7 jalr a5
80000788: fc1ff06f j 80000748 <__libc_init_array+0x54>
80000720 <__libc_init_array>:
80000720: ff010113 addi sp,sp,-16
80000724: 00812423 sw s0,8(sp)
80000728: 00912223 sw s1,4(sp)
8000072c: 00000417 auipc s0,0x0
80000730: 08c40413 addi s0,s0,140 # 800007b8 <__init_array_end>
80000734: 00000497 auipc s1,0x0
80000738: 08448493 addi s1,s1,132 # 800007b8 <__init_array_end>
8000073c: 408484b3 sub s1,s1,s0
80000740: 01212023 sw s2,0(sp)
80000744: 00112623 sw ra,12(sp)
80000748: 4024d493 srai s1,s1,0x2
8000074c: 00000913 li s2,0
80000750: 04991063 bne s2,s1,80000790 <__libc_init_array+0x70>
80000754: 00000417 auipc s0,0x0
80000758: 06440413 addi s0,s0,100 # 800007b8 <__init_array_end>
8000075c: 00000497 auipc s1,0x0
80000760: 05c48493 addi s1,s1,92 # 800007b8 <__init_array_end>
80000764: 408484b3 sub s1,s1,s0
80000768: 911ff0ef jal ra,80000078 <_init>
8000076c: 4024d493 srai s1,s1,0x2
80000770: 00000913 li s2,0
80000774: 02991863 bne s2,s1,800007a4 <__libc_init_array+0x84>
80000778: 00c12083 lw ra,12(sp)
8000077c: 00812403 lw s0,8(sp)
80000780: 00412483 lw s1,4(sp)
80000784: 00012903 lw s2,0(sp)
80000788: 01010113 addi sp,sp,16
8000078c: 00008067 ret
80000790: 00042783 lw a5,0(s0)
80000794: 00190913 addi s2,s2,1
80000798: 00440413 addi s0,s0,4
8000079c: 000780e7 jalr a5
800007a0: fb1ff06f j 80000750 <__libc_init_array+0x30>
800007a4: 00042783 lw a5,0(s0)
800007a8: 00190913 addi s2,s2,1
800007ac: 00440413 addi s0,s0,4
800007b0: 000780e7 jalr a5
800007b4: fc1ff06f j 80000774 <__libc_init_array+0x54>

View File

@ -1,133 +1,135 @@
:0200000480007A
:1000000017110000130101001705000013054578C2
:10001000970500009385C577170600001306867EB6
:100000001711000013010103170500001305057BFC
:10001000970500009385857A1716000013068681E0
:1000200063FCC5008322050023A05500130545008D
:1000300093854500E3E8C5FE170500001305857CA0
:10004000970500009385057C6378B50023200500A3
:1000500013054500E36CB5FEEF00C069EF008012A8
:1000300093854500E3E8C5FE170500001305857F9D
:10004000970500009385057F6378B50023200500A0
:1000500013054500E36CB5FEEF00806CEF00001265
:10006000970000009380400113050000B705008150
:10007000730020306F0000006780000073110134AE
:1000800023200100232211002326310023284100D0
:10009000232A5100232C6100232E7100232081028A
:1000A000232291022324A1022326B1022328C10284
:1000B000232AD102232CE102232EF1022320010561
:1000C0002322110523242105232631052328410558
:1000D000232A5105232C6105232E71052320810736
:1000E000232291072324A1072326B1072328C10730
:1000F000232AD107232CE107232EF107EF00C01E8E
:1001000003200100832041008321C100032201015B
:1001100083224101032381018323C10103240102BE
:1001200083244102032581028325C10203260103A2
:1001300083264103032781038327C1030328010486
:1001400083284104032981048329C104032A01056A
:10015000832A4105032B8105832BC105032C01064E
:10016000832C4106032D8106832DC106032E010732
:10017000832E4107032F8107832FC1077311013499
:0401800073002030B8
:10018400B70700809387C70773905730B71700806D
:10019400938707F873900734B7170000938707888D
:1001A4007390073073504030B70700C07390173412
:1001B400B7B70000938707107390273093070002A6
:1001C400739037307350301467800000B717008085
:1001D400938707F8131525003305F500032505005B
:1001E40067800000B717008013152500938707F870
:1001F4003305F5002320B50067800000130101FFDB
:1002040023261100EF00404BF3273034739037144A
:10021400F327103473901714F327203473902714A2
:10022400F3275010739017348320C1001301010188
:1002340067800000F327303473903714F327203499
:100244007390271473101514F327501073901734F8
:100254009307001073B0071093D5350093F505107C
:1002640073A00510B72700009387078073B0073089
:10027400B78700009387070873A0073067800000E2
:1002840037070200732007301707000013078701A0
:10029400731017349306100083270500930600009B
:1002A40037070200733007301385060023A0F500DA
:1002B400678000003707020073200730170700002B
:1002C4001307870173101734930710002320B50018
:1002D40093070000370702007330073013850700C7
:1002E40067800000130101FE232E1100232C8100DE
:1002F400232A91002328210123263101F3272034C6
:1003040063CE0714130720006384E7049306900068
:100314006396D710B71700809387070083A647FC1E
:100324001306100003A587FA6386C61E6384E622BB
:10033400638E061E032481018320C10183244101AD
:10034400032901018329C100130101026F00C03692
:10035400F3241034F3250030732430341306F002F0
:100364009376F4071357C4006386C6121306300746
:100374006396C60A137737006300F72493073000A7
:10038400630CF7229309100063043703EF00C032B3
:10039400F327303473903714F32710347390171401
:1003A400F327203473902714F327501073901734D5
:1003B400B717000013574401938617C06308D72E5C
:1003C400938717C86310F72CEF00803013090500DA
:1003D40063840902EF00402EF327303473903714FE
:1003E400F327103473901714F327203473902714D1
:1003F400F32750107390173413545400B717008028
:100404001374C407938707F83304F40023202401EA
:1004140093844400739014346F008002EF00C02969
:10042400F327303473903714F32710347390171470
:10043400F327203473902714F32750107390173444
:100444008320C10103248101832441010329010183
:100454008329C100130101026780000093F7F70F9D
:1004640013077000E39CE7FA9307000273A0471494
:100474009307000873B047308320C101032481012E
:1004840083244101032901018329C10013010102CD
:100494006780000013777700E312F7F81357D4004E
:1004A40093572401B7160080938606F81377C7077D
:1004B40093F7C7073307D700B387D700032707008D
:1004C40003A6070037050200732005301705000056
:1004D40013058501731015349307100003280700D2
:1004E4009307000037050200733005306390070856
:1004F4009357B4011305C001E362F5F23705008098
:10050400939727001305C578B387A70083A707002F
:10051400678007001375F50FEF00801AF327103476
:1005240093874700739017346FF09FF183A5C7FA40
:10053400EF00801A9307000873A047309307000266
:1005440073B04714F327103493874700739017341C
:100554006FF01FEF1307F0FF23A4E7FAF32710341B
:1005640093874700739017346FF09FEDF32730346F
:1005740073903714F3272034739027147390141452
:10058400F3275010739017349307001073B00710BB
:1005940093D5350093F5051073A00510B727000017
:1005A4009387078073B00730B787000093870708E5
:1005B40073A007306FF0DFE89359F40093F9F90161
:1005C400B33930016FF0DFDE3306060113545400F3
:1005D4001374C407B306D40023A00601B7060200AF
:1005E40073A0063097060000938686017390163434
:1005F400930710002320C70093070000B7060200EA
:1006040073B00630E38607E0F32730347390371471
:10061400F32720347390271473901414F327501085
:10062400739017349307001073B0071093D73500F5
:1006340093F7071073A007106FF05FF6E37806F9DD
:10064400130608006FF09FF8336606016FF01FF879
:10065400334606016FF09FF7E37AC8F613060800E5
:100664006FF0DFF6E35406F7130608006FF01FF689
:10067400E35EC8F4130608006FF05FF533760601F5
:100684006FF0DFF4EF004003F32730347390371436
:10069400F327103473901714F3272034739027141E
:1006A400F3275010739017346FF09FD2EF00C001FE
:1006B400130905006FF0DFD1232E00FE67800000D0
:1006C400232CA0FE67800000032500FE6780000045
:1006D400032540FE678000009307C0FE1307F0FF68
:1006E40023A0E7002324A0FE23A0B7006780000016
:1006F400130101FF23248100232291001704000029
:100704001304C4089704000093844408B384844009
:10071400232021012326110093D42440130900002F
:10072400631099041704000013044406970400009E
:100734009384C405B3848440EFF0DF9393D42440BE
:1007440013090000631899028320C1000324810067
:100754008324410003290100130101016780000083
:10076400832704001309190013044400E7800700D9
:100774006FF01FFB832704001309190013044400BE
:08078400E78007006FF01FFC85
:10078C00CC050080D005008020040080200400806F
:10079C005406008020040080200400802004008087
:1007AC004C0600802004008020040080200400807F
:1007BC00800600802004008020040080200400803B
:1007CC007406008020040080200400802004008037
:1007DC006806008020040080200400802004008033
:1007EC005C0600802004008020040080200400802F
:0407FC004006008033
:10008000232211002326310023284100232A510076
:10009000232C6100232E7100232081022322910250
:1000A0002324A1022326B1022328C102232AD1023C
:1000B000232CE102232EF102232001052322110526
:1000C000232421052326310523284105232A510510
:1000D000232C6105232E71052320810723229107FC
:1000E0002324A1072326B1072328C107232AD107E8
:1000F000232CE107232EF107EF00401F832041004E
:100100008321C100032201018322410103238101D4
:100110008323C101032401028324410203258102B8
:100120008325C1020326010383264103032781039C
:100130008327C10303280104832841040329810480
:100140008329C104032A0105832A4105032B810564
:10015000832BC105032C0106832C4106032D810648
:10016000832DC106032E0107832E4107032F81072C
:0C017000832FC10773110134730020308D
:10017C00B70700809387C70773905730B717008075
:10018C00938707FB73900734B71700009387078892
:10019C007390073073504030B70700C0739017341A
:1001AC00B7B70000938707107390273093070002AE
:1001BC00739037307350301467800000B71700808D
:1001CC00938707FB131525003305F5000325050060
:1001DC0067800000B717008013152500938707FB75
:1001EC003305F5002320B50067800000130101FFE3
:1001FC0023261100EF00804EF32730347390371410
:10020C00F327103473901714F327203473902714AA
:10021C00F3275010739017348320C1001301010190
:10022C0067800000B70700809387C707739057302B
:10023C00F327303473903714F3272034739027143A
:10024C0073101514F3275010739017349307001084
:10025C0073B0071093D5350093F5051073A00510F6
:10026C00B72700009387078073B00730B78700006B
:10027C009387070873A007306780000037070200D8
:10028C0073200730170700001307870173105730CE
:10029C009306100083270500930600003707020021
:1002AC00733007301385060023A0F500678000002B
:1002BC003707020073200730170700001307870168
:1002CC0073105730930710002320B50093070000DC
:1002DC003707020073300730138507006780000072
:1002EC00130101FE232E1100232C8100232A9100DF
:1002FC002328210123263101F327203463CE071450
:10030C00130720006384E704930690006396D710CC
:10031C00B71700809387070383A647FC13061000CA
:10032C0003A587FA6386C61E6384E622638E061EC7
:10033C00032481018320C10183244101032901018C
:10034C008329C100130101026F004039F3241034DA
:10035C00F3250030732430341306F0029376F4073F
:10036C001357C4006386C612130630076396C60A79
:10037C00137737006306F724930730006302F724E2
:10038C009309100063043703EF004035F327303432
:10039C0073903714F327103473901714F327203409
:1003AC0073902714F327501073901734B71700006D
:1003BC0013574401938617C06304D730938717C82B
:1003CC00631CF72CEF00003313090500638409024A
:1003DC00EF00C030F327303473903714F327103408
:1003EC0073901714F327203473902714F3275010AD
:1003FC007390173413545400B7170080938707FB7E
:10040C001374C4073304F4002320240193844400A0
:10041C00739014346F008002EF00402CF3273034BB
:10042C0073903714F327103473901714F327203478
:10043C0073902714F3275010739017348320C10145
:10044C000324810183244101032901018329C10073
:10045C00130101026780000093F7F70F1307700078
:10046C00E39CE7FA9307000273A047149307000874
:10047C0073B047308320C1010324810183244101DF
:10048C00032901018329C1001301010267800000C7
:10049C0013777700E312F7F81357D400935724011E
:1004AC00B7160080938606FB1377C70793F7C70729
:1004BC003307D700B387D7000327070003A607002D
:1004CC003705020073200530170500001305850160
:1004DC007310553093071000032807009307000092
:1004EC003705020073300530639007089357B40149
:1004FC001305C001E362F5F23705008093972700DE
:10050C001305857BB387A70083A7070067800700C7
:10051C001375F50FEF00001DF32710349387470078
:10052C00739017346FF09FF183A5C7FAEF00001D8D
:10053C009307000873A047309307000273B0471469
:10054C00F327103493874700739017346FF01FEF25
:10055C001307F0FF23A4E7FAF3271034938747001F
:10056C00739017346FF09FEDB70700809387C70720
:10057C0073905730F327303473903714F3272034AB
:10058C007390271473901414F3275010739017342E
:10059C009307001073B0071093D5350093F5051031
:1005AC0073A00510B72700009387078073B007303E
:1005BC00B78700009387070873A007306FF01FE818
:1005CC009359F40093F9F901B33930016FF01FDE40
:1005DC0033060601135454001374C407B306D40035
:1005EC0023A00601B707020073A00730970700008D
:1005FC009387870173905730930610002320C70010
:10060C0093060000B707020073B00730B7070080ED
:10061C009387C707638C060A73905730F3273034DF
:10062C0073903714F3272034739027147390141499
:10063C00F3275010739017349307001073B0071002
:10064C0093D7350093F7071073A007106FF09FF541
:10065C00E37206F9130608006FF0DFF7E37CC8F6C7
:10066C00130608006FF01FF7336606016FF09FF654
:10067C00334606016FF01FF6E35EC8F4130608005C
:10068C006FF05FF5337606016FF0DFF4E35406F597
:10069C00130608006FF01FF4EF004004F32730340A
:1006AC0073903714F327103473901714F3272034F6
:1006BC0073902714F3275010739017346FF01FD1D9
:1006CC00EF00C002130905006FF05FD09384440063
:1006DC0073901434739057306FF05FD6232E00FE56
:1006EC0067800000232CA0FE67800000032500FE1D
:1006FC0067800000032540FE678000009307C0FE62
:10070C001307F0FF23A0E7002324A0FE23A0B700CB
:10071C0067800000130101FF232481002322910034
:10072C00170400001304C4089704000093844408C1
:10073C00B3848440232021012326110093D4244028
:10074C0013090000631099041704000013044406F5
:10075C00970400009384C405B3848440EFF01F9188
:10076C0093D4244013090000631899028320C1001C
:10077C00032481008324410003290100130101019A
:10078C006780000083270400130919001304440038
:10079C00E78007006FF01FFB832704001309190083
:0C07AC0013044400E78007006FF01FFCFE
:1007B800DC050080E005008024040080240400801B
:1007C8007C06008024040080240400802404008027
:1007D800740600802404008024040080240400801F
:1007E80090060080240400802404008024040080F3
:1007F80084060080240400802404008024040080EF
:1008080098060080240400802404008024040080CA
:1008180068060080240400802404008024040080EA
:080828005C06008000000000E6
:040000058000000077
:00000001FF

View File

@ -39,10 +39,11 @@ void redirectTrap(){
}
void emulationTrapToSupervisorTrap(uint32_t sepc, uint32_t mstatus){
csr_write(mtvec, trapEntry);
csr_write(sbadaddr, csr_read(mbadaddr));
csr_write(scause, csr_read(mcause));
csr_write(sepc, sepc);
csr_write(mepc, csr_read(stvec));
csr_write(mepc, csr_read(stvec));
csr_clear(sstatus, MSTATUS_SPP);
csr_set(sstatus, (mstatus >> 3) & MSTATUS_SPP);
csr_clear(mstatus, MSTATUS_MPP);
@ -62,7 +63,7 @@ void emulationTrapToSupervisorTrap(uint32_t sepc, uint32_t mstatus){
//Will modify MEPC
//Will modify MTVEC
int32_t readWord(uint32_t address, int32_t *data){
int32_t result, tmp;
int32_t failed;
@ -70,7 +71,7 @@ int32_t readWord(uint32_t address, int32_t *data){
" li %[tmp], 0x00020000\n"
" csrs mstatus, %[tmp]\n"
" la %[tmp], 1f\n"
" csrw mepc, %[tmp]\n"
" csrw mtvec, %[tmp]\n"
" li %[failed], 1\n"
" lw %[result], 0(%[address])\n"
" li %[failed], 0\n"
@ -86,7 +87,7 @@ int32_t readWord(uint32_t address, int32_t *data){
return failed;
}
//Will modify MEPC
//Will modify MTVEC
int32_t writeWord(uint32_t address, int32_t data){
int32_t result, tmp;
int32_t failed;
@ -94,7 +95,7 @@ int32_t writeWord(uint32_t address, int32_t data){
" li %[tmp], 0x00020000\n"
" csrs mstatus, %[tmp]\n"
" la %[tmp], 1f\n"
" csrw mepc, %[tmp]\n"
" csrw mtvec, %[tmp]\n"
" li %[failed], 1\n"
" sw %[data], 0(%[address])\n"
" li %[failed], 0\n"
@ -167,6 +168,7 @@ void trap(){
return;
}
csr_write(mepc, mepc + 4);
csr_write(mtvec, trapEntry); //Restore mtvec
}break;
default: redirectTrap(); break;
} break;

View File

@ -4,7 +4,6 @@
trapEntry:
csrrw sp, mscratch, sp
sw x0, 0*4(sp)
sw x1, 1*4(sp)
sw x3, 3*4(sp)
sw x4, 4*4(sp)
@ -36,7 +35,6 @@ trapEntry:
sw x30, 30*4(sp)
sw x31, 31*4(sp)
call trap
lw x0, 0*4(sp)
lw x1, 1*4(sp)
lw x3, 3*4(sp)
lw x4, 4*4(sp)

View File

@ -112,7 +112,7 @@ class MmuPlugin(virtualRange : UInt => Bool,
requireMmuLockup clearWhen(!csr.status.mprv && privilegeService.isMachine())
when(privilegeService.isMachine()) {
if (port.priority == MmuPort.PRIORITY_DATA) {
requireMmuLockup clearWhen (!csr.status.mprv)
requireMmuLockup clearWhen (!csr.status.mprv || pipeline(MPP) === 3)
} else {
requireMmuLockup := False
}

View File

@ -1177,7 +1177,9 @@ public:
MemWrite t = periphWrites.front();
MemWrite t2 = periphWritesGolden.front();
if(t.address != t2.address || t.size != t2.size || t.data != t2.data){
cout << "periphWrite missmatch" << endl;
cout << hex << "periphWrite missmatch" << endl;
cout << " DUT address=" << t.address << " size=" << t.size << " data=" << t.data << endl;
cout << " REF address=" << t2.address << " size=" << t2.size << " data=" << t2.data << endl;
fail();
}
periphWrites.pop();
@ -3326,6 +3328,7 @@ int main(int argc, char **argv, char **env) {
->setDStall(false)
->bootAt(0x80000000)
->run(0);
// ->run(1173000000l );
#endif
// #ifdef MMU