Przeglądaj źródła

Modify justfile target; modify sepc in illegal instruction

luojia65 4 lat temu
rodzic
commit
24a980dbc4
3 zmienionych plików z 5 dodań i 3 usunięć
  1. 1 1
      platform/k210/justfile
  2. 1 1
      platform/qemu/justfile
  3. 3 1
      platform/qemu/src/main.rs

+ 1 - 1
platform/k210/justfile

@@ -1,4 +1,4 @@
-target := "riscv64gc-unknown-none-elf"
+target := "riscv64imac-unknown-none-elf"
 mode := "debug"
 build-path := "../../target/" + target + "/" + mode + "/"
 m-firmware-file := build-path + "rustsbi-k210"

+ 1 - 1
platform/qemu/justfile

@@ -1,4 +1,4 @@
-target := "riscv64gc-unknown-none-elf"
+target := "riscv64imac-unknown-none-elf"
 mode := "debug"
 build-path := "../../target/" + target + "/" + mode + "/"
 m-firmware-file := build-path + "rustsbi-qemu"

+ 3 - 1
platform/qemu/src/main.rs

@@ -457,10 +457,12 @@ extern "C" fn start_trap_rust(trap_frame: &mut TrapFrame) {
                 // 出现非法指令异常,转发到特权层
                 let cause: usize = 2; // Interrupt = 0, Exception Code = 2 (Illegal Exception)
                 let val: usize = mtval::read();
+                let epc: usize = mepc::read();
                 unsafe { asm!("
                     csrw    scause, {cause}
                     csrw    stval, {val}
-                ", cause = in(reg) cause, val = in(reg) val) };
+                    csrw    sepc, {epc}
+                ", cause = in(reg) cause, val = in(reg) val, epc = in(reg) epc) };
                 // todo: remove these following lines
                 // 先把“test-kernel”写完,功能完整后,删除下面几行
                 #[cfg(target_pointer_width = "64")]