diff --git a/src/test/cpp/raw/pmp/build/pmp.asm b/src/test/cpp/raw/pmp/build/pmp.asm index 48395cf..9d5dddf 100644 --- a/src/test/cpp/raw/pmp/build/pmp.asm +++ b/src/test/cpp/raw/pmp/build/pmp.asm @@ -25,17 +25,17 @@ Disassembly of section .crt_section: 80000030 : 80000030: 00000e13 li t3,0 80000034: 00000f17 auipc t5,0x0 -80000038: 1f4f0f13 addi t5,t5,500 # 80000228 +80000038: 1f0f0f13 addi t5,t5,496 # 80000224 8000003c: 800000b7 lui ra,0x80000 80000040: 80008237 lui tp,0x80008 80000044: deadc137 lui sp,0xdeadc -80000048: eef10113 addi sp,sp,-273 # deadbeef -8000004c: 0020a023 sw sp,0(ra) # 80000000 -80000050: 00222023 sw sp,0(tp) # 80008000 +80000048: eef10113 addi sp,sp,-273 # deadbeef +8000004c: 0020a023 sw sp,0(ra) # 80000000 +80000050: 00222023 sw sp,0(tp) # 80008000 80000054: 0000a183 lw gp,0(ra) -80000058: 1c311863 bne sp,gp,80000228 +80000058: 1c311663 bne sp,gp,80000224 8000005c: 00022183 lw gp,0(tp) # 0 <_start-0x80000000> -80000060: 1c311463 bne sp,gp,80000228 +80000060: 1c311263 bne sp,gp,80000224 80000064: 071a12b7 lui t0,0x71a1 80000068: 80828293 addi t0,t0,-2040 # 71a0808 <_start-0x78e5f7f8> 8000006c: 3a029073 csrw pmpcfg0,t0 @@ -90,82 +90,81 @@ Disassembly of section .crt_section: 80000130: 0020a023 sw sp,0(ra) 80000134: 00222023 sw sp,0(tp) # 0 <_start-0x80000000> 80000138: 0000a183 lw gp,0(ra) -8000013c: 0e311663 bne sp,gp,80000228 +8000013c: 0e311463 bne sp,gp,80000224 80000140: 00022183 lw gp,0(tp) # 0 <_start-0x80000000> -80000144: 0e311263 bne sp,gp,80000228 -80000148: 06c0006f j 800001b4 +80000144: 0e311063 bne sp,gp,80000224 -8000014c : -8000014c: 00100e13 li t3,1 -80000150: 00000f17 auipc t5,0x0 -80000154: 0d8f0f13 addi t5,t5,216 # 80000228 -80000158: 079a12b7 lui t0,0x79a1 -8000015c: 80828293 addi t0,t0,-2040 # 79a0808 <_start-0x7865f7f8> -80000160: 3a029073 csrw pmpcfg0,t0 -80000164: deadc137 lui sp,0xdeadc -80000168: eef10113 addi sp,sp,-273 # deadbeef -8000016c: 00222023 sw sp,0(tp) # 0 <_start-0x80000000> -80000170: 00000f17 auipc t5,0x0 -80000174: 010f0f13 addi t5,t5,16 # 80000180 -80000178: 00022183 lw gp,0(tp) # 0 <_start-0x80000000> -8000017c: 0ac0006f j 80000228 +80000148 : +80000148: 00100e13 li t3,1 +8000014c: 00000f17 auipc t5,0x0 +80000150: 0d8f0f13 addi t5,t5,216 # 80000224 +80000154: 079a12b7 lui t0,0x79a1 +80000158: 80828293 addi t0,t0,-2040 # 79a0808 <_start-0x7865f7f8> +8000015c: 3a029073 csrw pmpcfg0,t0 +80000160: deadc137 lui sp,0xdeadc +80000164: eef10113 addi sp,sp,-273 # deadbeef +80000168: 00222023 sw sp,0(tp) # 0 <_start-0x80000000> +8000016c: 00000f17 auipc t5,0x0 +80000170: 010f0f13 addi t5,t5,16 # 8000017c +80000174: 00022183 lw gp,0(tp) # 0 <_start-0x80000000> +80000178: 0ac0006f j 80000224 -80000180 : -80000180: 00200e13 li t3,2 -80000184: 00000f17 auipc t5,0x0 -80000188: 0a4f0f13 addi t5,t5,164 # 80000228 -8000018c: 071a12b7 lui t0,0x71a1 -80000190: 80828293 addi t0,t0,-2040 # 71a0808 <_start-0x78e5f7f8> -80000194: 3a029073 csrw pmpcfg0,t0 -80000198: deadc137 lui sp,0xdeadc -8000019c: eef10113 addi sp,sp,-273 # deadbeef -800001a0: 00222023 sw sp,0(tp) # 0 <_start-0x80000000> -800001a4: 00000f17 auipc t5,0x0 -800001a8: 010f0f13 addi t5,t5,16 # 800001b4 -800001ac: 00022183 lw gp,0(tp) # 0 <_start-0x80000000> -800001b0: 0780006f j 80000228 +8000017c : +8000017c: 00200e13 li t3,2 +80000180: 00000f17 auipc t5,0x0 +80000184: 0a4f0f13 addi t5,t5,164 # 80000224 +80000188: 071a12b7 lui t0,0x71a1 +8000018c: 80828293 addi t0,t0,-2040 # 71a0808 <_start-0x78e5f7f8> +80000190: 3a029073 csrw pmpcfg0,t0 +80000194: deadc137 lui sp,0xdeadc +80000198: eef10113 addi sp,sp,-273 # deadbeef +8000019c: 00222023 sw sp,0(tp) # 0 <_start-0x80000000> +800001a0: 00000f17 auipc t5,0x0 +800001a4: 010f0f13 addi t5,t5,16 # 800001b0 +800001a8: 00022183 lw gp,0(tp) # 0 <_start-0x80000000> +800001ac: 0780006f j 80000224 -800001b4 : -800001b4: 00300e13 li t3,3 -800001b8: 00000f17 auipc t5,0x0 -800001bc: 070f0f13 addi t5,t5,112 # 80000228 -800001c0: 00000e97 auipc t4,0x0 -800001c4: 00ce8e93 addi t4,t4,12 # 800001cc -800001c8: e51ff06f j 80000018 +800001b0 : +800001b0: 00300e13 li t3,3 +800001b4: 00000f17 auipc t5,0x0 +800001b8: 070f0f13 addi t5,t5,112 # 80000224 +800001bc: 00000e97 auipc t4,0x0 +800001c0: 00ce8e93 addi t4,t4,12 # 800001c8 +800001c4: e55ff06f j 80000018 -800001cc : -800001cc: 00400e13 li t3,4 -800001d0: 00000f17 auipc t5,0x0 -800001d4: 058f0f13 addi t5,t5,88 # 80000228 -800001d8: deadc137 lui sp,0xdeadc -800001dc: eef10113 addi sp,sp,-273 # deadbeef -800001e0: 00222023 sw sp,0(tp) # 0 <_start-0x80000000> -800001e4: 00000f17 auipc t5,0x0 -800001e8: 010f0f13 addi t5,t5,16 # 800001f4 -800001ec: 00022183 lw gp,0(tp) # 0 <_start-0x80000000> -800001f0: 0380006f j 80000228 +800001c8 : +800001c8: 00400e13 li t3,4 +800001cc: 00000f17 auipc t5,0x0 +800001d0: 058f0f13 addi t5,t5,88 # 80000224 +800001d4: deadc137 lui sp,0xdeadc +800001d8: eef10113 addi sp,sp,-273 # deadbeef +800001dc: 00222023 sw sp,0(tp) # 0 <_start-0x80000000> +800001e0: 00000f17 auipc t5,0x0 +800001e4: 010f0f13 addi t5,t5,16 # 800001f0 +800001e8: 00022183 lw gp,0(tp) # 0 <_start-0x80000000> +800001ec: 0380006f j 80000224 -800001f4 : -800001f4: 00500e13 li t3,5 -800001f8: 00000f17 auipc t5,0x0 -800001fc: 03cf0f13 addi t5,t5,60 # 80000234 -80000200: 80010237 lui tp,0x80010 -80000204: deadc137 lui sp,0xdeadc -80000208: eef10113 addi sp,sp,-273 # deadbeef -8000020c: 0020a023 sw sp,0(ra) -80000210: 0000a183 lw gp,0(ra) -80000214: 00311a63 bne sp,gp,80000228 -80000218: 00022183 lw gp,0(tp) # 80010000 -8000021c: 00000f17 auipc t5,0x0 -80000220: 018f0f13 addi t5,t5,24 # 80000234 -80000224: 00322023 sw gp,0(tp) # 0 <_start-0x80000000> +800001f0 : +800001f0: 00500e13 li t3,5 +800001f4: 00000f17 auipc t5,0x0 +800001f8: 03cf0f13 addi t5,t5,60 # 80000230 +800001fc: 80010237 lui tp,0x80010 +80000200: deadc137 lui sp,0xdeadc +80000204: eef10113 addi sp,sp,-273 # deadbeef +80000208: 0020a023 sw sp,0(ra) +8000020c: 0000a183 lw gp,0(ra) +80000210: 00311a63 bne sp,gp,80000224 +80000214: 00022183 lw gp,0(tp) # 80010000 +80000218: 00000f17 auipc t5,0x0 +8000021c: 018f0f13 addi t5,t5,24 # 80000230 +80000220: 00322023 sw gp,0(tp) # 0 <_start-0x80000000> -80000228 : -80000228: f0100137 lui sp,0xf0100 -8000022c: f2410113 addi sp,sp,-220 # f00fff24 -80000230: 01c12023 sw t3,0(sp) +80000224 : +80000224: f0100137 lui sp,0xf0100 +80000228: f2410113 addi sp,sp,-220 # f00fff24 +8000022c: 01c12023 sw t3,0(sp) -80000234 : -80000234: f0100137 lui sp,0xf0100 -80000238: f2010113 addi sp,sp,-224 # f00fff20 -8000023c: 00012023 sw zero,0(sp) +80000230 : +80000230: f0100137 lui sp,0xf0100 +80000234: f2010113 addi sp,sp,-224 # f00fff20 +80000238: 00012023 sw zero,0(sp) diff --git a/src/test/cpp/raw/pmp/build/pmp.elf b/src/test/cpp/raw/pmp/build/pmp.elf index 9b21344..381eec7 100755 Binary files a/src/test/cpp/raw/pmp/build/pmp.elf and b/src/test/cpp/raw/pmp/build/pmp.elf differ diff --git a/src/test/cpp/raw/pmp/build/pmp.hex b/src/test/cpp/raw/pmp/build/pmp.hex index 3f75e5d..840a560 100644 --- a/src/test/cpp/raw/pmp/build/pmp.hex +++ b/src/test/cpp/raw/pmp/build/pmp.hex @@ -2,10 +2,10 @@ :100000009700000093800001739050306F00400211 :1000100073101F34730020303741010073300130FA :10002000130100207320013073901E3473002030C0 -:10003000130E0000170F0000130F4F1FB7000080B2 +:10003000130E0000170F0000130F0F1FB7000080F2 :100040003782008037C1ADDE1301F1EE23A020001E -:100050002320220083A100006318311C83210200A9 -:100060006314311CB7121A07938282807390023A8C +:100050002320220083A100006316311C83210200AB +:100060006312311CB7121A07938282807390023A8E :10007000B7021C19938242507390123A9302800186 :100080007390223AB7221E0F938202907390323AF5 :10009000B70200207390023B9302F0FF7390123B73 @@ -18,22 +18,22 @@ :10010000930200007390B23B930200007390C23BD5 :10011000930200007390D23B930200007390E23B85 :10012000930200007390F23B3701C1001301E1FE1E -:1001300023A020002320220083A100006316310E9B -:10014000832102006312310E6F00C006130E1000EF -:10015000170F0000130F8F0DB7129A07938282803A -:100160007390023A37C1ADDE1301F1EE2320220075 -:10017000170F0000130F0F01832102006F00C00A48 -:10018000130E2000170F0000130F4F0AB7121A07A3 -:10019000938282807390023A37C1ADDE1301F1EE93 -:1001A00023202200170F0000130F0F0183210200EC -:1001B0006F008007130E3000170F0000130F0F079A -:1001C000970E0000938ECE006FF01FE5130E4000D7 -:1001D000170F0000130F8F0537C1ADDE1301F1EECD -:1001E00023202200170F0000130F0F0183210200AC -:1001F0006F008003130E5000170F0000130FCF0382 -:100200003702018037C1ADDE1301F1EE23A02000DB -:1002100083A10000631A310083210200170F000040 -:10022000130F8F0123203200370110F0130141F228 -:100230002320C101370110F0130101F22320010036 +:1001300023A020002320220083A100006314310E9D +:10014000832102006310310E130E1000170F000000 +:10015000130F8F0DB7129A07938282807390023A21 +:1001600037C1ADDE1301F1EE23202200170F00008E +:10017000130F0F01832102006F00C00A130E20002D +:10018000170F0000130F4F0AB7121A0793828280CD +:100190007390023A37C1ADDE1301F1EE2320220045 +:1001A000170F0000130F0F01832102006F0080075B +:1001B000130E3000170F0000130F0F07970E0000EB +:1001C000938ECE006FF05FE5130E4000170F000016 +:1001D000130F8F0537C1ADDE1301F1EE232022008E +:1001E000170F0000130F0F01832102006F0080031F +:1001F000130E5000170F0000130FCF0337020180BA +:1002000037C1ADDE1301F1EE23A0200083A1000071 +:10021000631A310083210200170F0000130F8F01B2 +:1002200023203200370110F0130141F22320C101D5 +:0C023000370110F0130101F2232001003F :040000058000000077 :00000001FF diff --git a/src/test/cpp/raw/pmp/build/pmp.map b/src/test/cpp/raw/pmp/build/pmp.map index f2252f3..ede4c4b 100644 --- a/src/test/cpp/raw/pmp/build/pmp.map +++ b/src/test/cpp/raw/pmp/build/pmp.map @@ -15,20 +15,20 @@ LOAD /opt/riscv/lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-e END GROUP LOAD /opt/riscv/lib/gcc/riscv64-unknown-elf/10.2.0/libgcc.a -.crt_section 0x0000000080000000 0x240 +.crt_section 0x0000000080000000 0x23c 0x0000000080000000 . = ALIGN (0x4) *crt.o(.text) - .text 0x0000000080000000 0x240 build/src/crt.o + .text 0x0000000080000000 0x23c build/src/crt.o 0x0000000080000000 _start 0x0000000080000010 trap 0x0000000080000018 to_user OUTPUT(build/pmp.elf elf32-littleriscv) -.data 0x0000000080000240 0x0 - .data 0x0000000080000240 0x0 build/src/crt.o +.data 0x000000008000023c 0x0 + .data 0x000000008000023c 0x0 build/src/crt.o -.bss 0x0000000080000240 0x0 - .bss 0x0000000080000240 0x0 build/src/crt.o +.bss 0x000000008000023c 0x0 + .bss 0x000000008000023c 0x0 build/src/crt.o .riscv.attributes 0x0000000000000000 0x1e diff --git a/src/test/cpp/regression/main.cpp b/src/test/cpp/regression/main.cpp index dca31a7..acc7793 100644 --- a/src/test/cpp/regression/main.cpp +++ b/src/test/cpp/regression/main.cpp @@ -725,23 +725,54 @@ public: if (!pmpcfg[3].reg[1].l) maskedWrite(pmpcfg[3].raw, value, 0xff0000); if (!pmpcfg[3].reg[0].l) maskedWrite(pmpcfg[3].raw, value, 0xff000000); break; - - case PMPADDR0: pmpaddr[0] = value; break; - case PMPADDR1: pmpaddr[1] = value; break; - case PMPADDR2: pmpaddr[2] = value; break; - case PMPADDR3: pmpaddr[3] = value; break; - case PMPADDR4: pmpaddr[4] = value; break; - case PMPADDR5: pmpaddr[5] = value; break; - case PMPADDR6: pmpaddr[6] = value; break; - case PMPADDR7: pmpaddr[7] = value; break; - case PMPADDR8: pmpaddr[8] = value; break; - case PMPADDR9: pmpaddr[9] = value; break; - case PMPADDR10: pmpaddr[10] = value; break; - case PMPADDR11: pmpaddr[11] = value; break; - case PMPADDR12: pmpaddr[12] = value; break; - case PMPADDR13: pmpaddr[13] = value; break; - case PMPADDR14: pmpaddr[14] = value; break; - case PMPADDR15: pmpaddr[15] = value; break; + case PMPADDR0: + if (!pmpcfg[0].reg[3].l) pmpaddr[0] = value; + break; + case PMPADDR1: + if (!pmpcfg[0].reg[2].l) pmpaddr[1] = value; + break; + case PMPADDR2: + if (!pmpcfg[0].reg[1].l) pmpaddr[2] = value; + break; + case PMPADDR3: + if (!pmpcfg[0].reg[0].l) pmpaddr[3] = value; + break; + case PMPADDR4: + if (!pmpcfg[1].reg[3].l) pmpaddr[4] = value; + break; + case PMPADDR5: + if (!pmpcfg[1].reg[2].l) pmpaddr[5] = value; + break; + case PMPADDR6: + if (!pmpcfg[1].reg[1].l) pmpaddr[6] = value; + break; + case PMPADDR7: + if (!pmpcfg[1].reg[0].l) pmpaddr[7] = value; + break; + case PMPADDR8: + if (!pmpcfg[2].reg[3].l) pmpaddr[8] = value; + break; + case PMPADDR9: + if (!pmpcfg[2].reg[2].l) pmpaddr[9] = value; + break; + case PMPADDR10: + if (!pmpcfg[2].reg[1].l) pmpaddr[10] = value; + break; + case PMPADDR11: + if (!pmpcfg[2].reg[0].l) pmpaddr[11] = value; + break; + case PMPADDR12: + if (!pmpcfg[3].reg[3].l) pmpaddr[12] = value; + break; + case PMPADDR13: + if (!pmpcfg[3].reg[2].l) pmpaddr[13] = value; + break; + case PMPADDR14: + if (!pmpcfg[3].reg[1].l) pmpaddr[14] = value; + break; + case PMPADDR15: + if (!pmpcfg[3].reg[0].l) pmpaddr[15] = value; + break; default: ilegalInstruction(); return true; break; }