From 9aea49072171739af128b319f3509652f6c479ba Mon Sep 17 00:00:00 2001 From: tracer-ysyx Date: Wed, 6 Mar 2024 11:38:47 +0800 Subject: [PATCH] =?UTF-8?q?>=20compile=20NEMU=20ysyx=5F22040000=20?= =?UTF-8?q?=E6=9D=8E=E5=BF=83=E6=9D=A8=20Linux=20calcite=206.6.18=20#1-Nix?= =?UTF-8?q?OS=20SMP=20PREEMPT=5FDYNAMIC=20Fri=20Feb=2023=2008:25:28=20UTC?= =?UTF-8?q?=202024=20x86=5F64=20GNU/Linux=20=2011:38:47=20=20up=201=20day?= =?UTF-8?q?=2015:07,=20=202=20users,=20=20load=20average:=200.48,=200.44,?= =?UTF-8?q?=200.38?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nemu/1 | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++ nemu/Makefile | 2 +- 2 files changed, 176 insertions(+), 1 deletion(-) create mode 100644 nemu/1 diff --git a/nemu/1 b/nemu/1 new file mode 100644 index 0000000..e6a8739 --- /dev/null +++ b/nemu/1 @@ -0,0 +1,175 @@ +[INFO] src/utils/log.c:30 init_log() Log is written to stdout +[INFO] src/utils/log.c:30 init_log() Log is written to stdout +[INFO] src/memory/paddr.c:50 init_mem() physical memory area [0x80000000, 0x87ffffff] +[INFO] src/memory/paddr.c:50 init_mem() physical memory area [0x80000000, 0x87ffffff] +[INFO] src/monitor/monitor.c:59 load_img() The image is /nix/store/d0jlcjdrgsb5pis8flyy5ihifdnfhms5-am-kernels-riscv32-none-elf-2024.02.18/share/images/goldbach-riscv32-nemu.bin, size = 329 +[INFO] src/monitor/monitor.c:59 load_img() The image is /nix/store/d0jlcjdrgsb5pis8flyy5ihifdnfhms5-am-kernels-riscv32-none-elf-2024.02.18/share/images/goldbach-riscv32-nemu.bin, size = 329 +[INFO] src/monitor/monitor.c:28 welcome() Trace: ON +[INFO] src/monitor/monitor.c:28 welcome() Trace: ON +[INFO] src/monitor/monitor.c:29 welcome() If trace is enabled, a log file will be generated to record the trace. This may lead to a large log file. If it is not necessary, you can disable it in menuconfig +[INFO] src/monitor/monitor.c:29 welcome() If trace is enabled, a log file will be generated to record the trace. This may lead to a large log file. If it is not necessary, you can disable it in menuconfig +[INFO] src/monitor/monitor.c:32 welcome() Build time: 00:00:00, Jan 1 1980 +[INFO] src/monitor/monitor.c:32 welcome() Build time: 00:00:00, Jan 1 1980 +Welcome to riscv32-NEMU! +For help, type "help" +0x80000000: 00 00 04 13 addi s0, zero, 0 +0x80000004: 00 00 91 17 auipc sp, 9 +0x80000008: ff c1 01 13 addi sp, sp, -4 +0x8000000c: 11 c0 00 ef jal ra, 0x80000128 +0x80000128: ff 01 01 13 addi sp, sp, -16 +0x8000012c: 00 00 05 17 auipc a0, 0 +0x80000130: 01 c5 05 13 addi a0, a0, 28 +0x80000134: 00 11 26 23 sw ra, 12(sp) +0x80000138: f9 9f f0 ef jal ra, 0x800000d0 +0x800000d0: ff 01 01 13 addi sp, sp, -16 +0x800000d4: 00 81 24 23 sw s0, 8(sp) +0x800000d8: 00 91 22 23 sw s1, 4(sp) +0x800000dc: 00 11 26 23 sw ra, 12(sp) +0x800000e0: 00 40 04 13 addi s0, zero, 4 +0x800000e4: 02 00 04 93 addi s1, zero, 32 +0x800000e8: 00 04 05 13 addi a0, s0, 0 +0x800000ec: f3 df f0 ef jal ra, 0x80000028 +0x80000028: 00 20 07 93 addi a5, zero, 2 +0x8000002c: 00 05 08 13 addi a6, a0, 0 +0x80000030: 08 a7 d8 63 bge a5, a0, 0x800000c0 +0x80000034: ff e5 07 13 addi a4, a0, -2 +0x80000038: 00 10 07 93 addi a5, zero, 1 +0x8000003c: 00 00 05 13 addi a0, zero, 0 +0x80000040: 06 f7 0e 63 beq a4, a5, 0x800000bc +0x80000044: 00 07 05 93 addi a1, a4, 0 +0x80000048: 00 20 06 93 addi a3, zero, 2 +0x8000004c: 00 20 03 13 addi t1, zero, 2 +0x80000050: 00 10 08 93 addi a7, zero, 1 +0x80000050: 00 10 08 93 addi a7, zero, 1 +0x80000054: 06 67 0a 63 beq a4, t1, 0x800000c8 +0x800000c8: 00 10 05 13 addi a0, zero, 1 +0x800000cc: 00 00 80 67 jalr zero, 0(ra) +0x800000f0: ff f5 05 13 addi a0, a0, -1 +0x800000f4: 00 15 35 13 sltiu a0, a0, 1 +0x800000f8: 00 24 04 13 addi s0, s0, 2 +0x800000fc: f1 5f f0 ef jal ra, 0x80000010 +0x80000010: 00 05 04 63 beq a0, zero, 0x80000018 +0x80000014: 00 00 80 67 jalr zero, 0(ra) +0x80000014: 00 00 80 67 jalr zero, 0(ra) +0x80000100: fe 94 14 e3 bne s0, s1, 0x800000e8 +0x800000e8: 00 04 05 13 addi a0, s0, 0 +0x800000ec: f3 df f0 ef jal ra, 0x80000028 +0x80000028: 00 20 07 93 addi a5, zero, 2 +0x8000002c: 00 05 08 13 addi a6, a0, 0 +0x80000030: 08 a7 d8 63 bge a5, a0, 0x800000c0 +0x80000034: ff e5 07 13 addi a4, a0, -2 +0x80000038: 00 10 07 93 addi a5, zero, 1 +0x8000003c: 00 00 05 13 addi a0, zero, 0 +0x80000040: 06 f7 0e 63 beq a4, a5, 0x800000bc +0x80000044: 00 07 05 93 addi a1, a4, 0 +0x80000048: 00 20 06 93 addi a3, zero, 2 +0x8000004c: 00 20 03 13 addi t1, zero, 2 +0x80000050: 00 10 08 93 addi a7, zero, 1 +0x80000054: 06 67 0a 63 beq a4, t1, 0x800000c8 +0x80000058: 00 17 75 13 andi a0, a4, 1 +0x8000005c: 00 20 07 93 addi a5, zero, 2 +0x80000060: 00 05 18 63 bne a0, zero, 0x80000070 +0x80000064: 02 00 00 6f jal zero, 0x80000084 +0x80000084: 00 06 86 13 addi a2, a3, 0 +0x80000088: 00 16 86 93 addi a3, a3, 1 +0x8000008c: ff f5 85 93 addi a1, a1, -1 +0x80000090: 02 d8 08 63 beq a6, a3, 0x800000c0 +0x80000094: 00 16 f7 93 andi a5, a3, 1 +0x80000098: fe 07 86 e3 beq a5, zero, 0x80000084 +0x8000009c: 00 20 07 93 addi a5, zero, 2 +0x800000a0: 00 c0 00 6f jal zero, 0x800000ac +0x800000ac: 00 07 87 13 addi a4, a5, 0 +0x800000b0: 00 17 87 93 addi a5, a5, 1 +0x800000b4: fe c7 18 e3 bne a4, a2, 0x800000a4 +0x800000b8: fc 5f f0 6f jal zero, 0x8000007c +0x8000007c: 00 05 87 13 addi a4, a1, 0 +0x8000007c: 00 05 87 13 addi a4, a1, 0 +0x80000080: fc b8 ca e3 blt a7, a1, 0x80000054 +0x80000054: 06 67 0a 63 beq a4, t1, 0x800000c8 +0x80000058: 00 17 75 13 andi a0, a4, 1 +0x8000005c: 00 20 07 93 addi a5, zero, 2 +0x8000005c: 00 20 07 93 addi a5, zero, 2 +0x80000060: 00 05 18 63 bne a0, zero, 0x80000070 +0x80000070: 00 17 87 93 addi a5, a5, 1 +0x80000074: fe e7 9a e3 bne a5, a4, 0x80000068 +0x80000078: 00 00 80 67 jalr zero, 0(ra) +0x800000f0: ff f5 05 13 addi a0, a0, -1 +0x800000f4: 00 15 35 13 sltiu a0, a0, 1 +0x800000f8: 00 24 04 13 addi s0, s0, 2 +0x800000fc: f1 5f f0 ef jal ra, 0x80000010 +0x80000010: 00 05 04 63 beq a0, zero, 0x80000018 +0x80000014: 00 00 80 67 jalr zero, 0(ra) +0x80000014: 00 00 80 67 jalr zero, 0(ra) +0x80000100: fe 94 14 e3 bne s0, s1, 0x800000e8 +0x800000e8: 00 04 05 13 addi a0, s0, 0 +0x800000ec: f3 df f0 ef jal ra, 0x80000028 +0x80000028: 00 20 07 93 addi a5, zero, 2 +0x8000002c: 00 05 08 13 addi a6, a0, 0 +0x80000030: 08 a7 d8 63 bge a5, a0, 0x800000c0 +0x80000034: ff e5 07 13 addi a4, a0, -2 +0x80000038: 00 10 07 93 addi a5, zero, 1 +0x8000003c: 00 00 05 13 addi a0, zero, 0 +0x80000040: 06 f7 0e 63 beq a4, a5, 0x800000bc +0x80000044: 00 07 05 93 addi a1, a4, 0 +0x80000048: 00 20 06 93 addi a3, zero, 2 +0x8000004c: 00 20 03 13 addi t1, zero, 2 +0x80000050: 00 10 08 93 addi a7, zero, 1 +0x80000054: 06 67 0a 63 beq a4, t1, 0x800000c8 +0x80000058: 00 17 75 13 andi a0, a4, 1 +0x8000005c: 00 20 07 93 addi a5, zero, 2 +0x80000060: 00 05 18 63 bne a0, zero, 0x80000070 +0x80000064: 02 00 00 6f jal zero, 0x80000084 +0x80000084: 00 06 86 13 addi a2, a3, 0 +0x80000088: 00 16 86 93 addi a3, a3, 1 +0x8000008c: ff f5 85 93 addi a1, a1, -1 +0x80000090: 02 d8 08 63 beq a6, a3, 0x800000c0 +0x80000094: 00 16 f7 93 andi a5, a3, 1 +0x80000098: fe 07 86 e3 beq a5, zero, 0x80000084 +0x8000009c: 00 20 07 93 addi a5, zero, 2 +0x800000a0: 00 c0 00 6f jal zero, 0x800000ac +0x800000ac: 00 07 87 13 addi a4, a5, 0 +0x800000b0: 00 17 87 93 addi a5, a5, 1 +0x800000b4: fe c7 18 e3 bne a4, a2, 0x800000a4 +0x800000b8: fc 5f f0 6f jal zero, 0x8000007c +0x8000007c: 00 05 87 13 addi a4, a1, 0 +0x8000007c: 00 05 87 13 addi a4, a1, 0 +0x80000080: fc b8 ca e3 blt a7, a1, 0x80000054 +0x80000054: 06 67 0a 63 beq a4, t1, 0x800000c8 +0x80000058: 00 17 75 13 andi a0, a4, 1 +0x8000005c: 00 20 07 93 addi a5, zero, 2 +0x8000005c: 00 20 07 93 addi a5, zero, 2 +0x80000060: 00 05 18 63 bne a0, zero, 0x80000070 +0x80000070: 00 17 87 93 addi a5, a5, 1 +0x80000070: 00 17 87 93 addi a5, a5, 1 +0x80000074: fe e7 9a e3 bne a5, a4, 0x80000068 +invalid opcode(PC = 0x80000068): + 33 66 f7 02 63 0c 06 00 ... + 02f76633 00060c63... +There are two cases which will trigger this unexpected exception: +1. The instruction at PC = 0x80000068 is not implemented. +2. Something is implemented incorrectly. +Find this PC(0x80000068) in the disassembling result to distinguish which case it is. + +If it is the first case, see + _ __ __ _ + (_) | \/ | | | + _ __ _ ___ ___ ________ __ | \ / | __ _ _ __ _ _ __ _| | + | '__| / __|/ __|______\ \ / / | |\/| |/ _` | '_ \| | | |/ _` | | + | | | \__ \ (__ \ V / | | | | (_| | | | | |_| | (_| | | + |_| |_|___/\___| \_/ |_| |_|\__,_|_| |_|\__,_|\__,_|_| + +for more details. + +If it is the second case, remember: +* The machine is always right! +* Every line of untested code is always wrong! + +0x80000068: 02 f7 66 33 rem a2, a4, a5 +[INFO] src/cpu/cpu-exec.c:125 cpu_exec() nemu: ABORT at pc = 0x80000068 +[INFO] src/cpu/cpu-exec.c:125 cpu_exec() nemu: ABORT at pc = 0x80000068 +[INFO] src/cpu/cpu-exec.c:93 statistic() host time spent = 383 us +[INFO] src/cpu/cpu-exec.c:93 statistic() host time spent = 383 us +[INFO] src/cpu/cpu-exec.c:94 statistic() total guest instructions = 123 +[INFO] src/cpu/cpu-exec.c:94 statistic() total guest instructions = 123 +[INFO] src/cpu/cpu-exec.c:95 statistic() simulation frequency = 321,148 inst/s +[INFO] src/cpu/cpu-exec.c:95 statistic() simulation frequency = 321,148 inst/s diff --git a/nemu/Makefile b/nemu/Makefile index 546de80..c4fac9e 100644 --- a/nemu/Makefile +++ b/nemu/Makefile @@ -83,7 +83,7 @@ $(IMAGES): %: %.bin $(BINARY) integration-tests: $(IMAGES) @cat $(RESULT) - @echo $(shell wc -l $(RESULT)) + @echo $(shell wc -l $(RESULT) | cut -f1) @$(RM) $(RESULT) test: unit-tests integration-tests