瀏覽代碼

Small fix for illegal instruction testcase

luojia65 4 年之前
父節點
當前提交
24bf4e39ec
共有 3 個文件被更改,包括 4 次插入4 次删除
  1. 1 1
      README.md
  2. 2 2
      platform/qemu/README.md
  3. 1 1
      test-kernel/src/main.rs

+ 1 - 1
README.md

@@ -33,7 +33,7 @@ in `platform`, and a simple operating system kernel to test SBI implementations
 
 The test kernel is used to test SBI functions. Boot this kernel using your platform,
 it will call all SBI calls and run instructions to test if underlying SBI environment is okay.
-if this kernel reports 'Ok' and exits normally, it means that your SBI implementation is correct.
+if this kernel reports 'SUCCESS' and exits normally, it means that your SBI implementation is correct.
 
 ## Talks and documents
 

+ 2 - 2
platform/qemu/README.md

@@ -27,6 +27,6 @@ When running `just run`, the test kernel will build and run. Expected output sho
 [rustsbi] Kernel entry: 0x80200000
 << Test-kernel: Hart id = 0, DTB physical address = 0x1020
 >> Test-kernel: Trigger illegal exception
-<< Test-kernel: Illegal exception
-<< Test-kernel: SBI test success, shutdown
+<< Test-kernel: Illegal exception delegate success
+<< Test-kernel: SBI test SUCCESS, shutdown
 ```

+ 1 - 1
test-kernel/src/main.rs

@@ -13,7 +13,7 @@ pub extern "C" fn rust_main(hartid: usize, dtb_pa: usize) -> ! {
     println!("<< Test-kernel: Hart id = {}, DTB physical address = {:#x}", hartid, dtb_pa);
     unsafe { stvec::write(start_trap as usize, TrapMode::Direct) };
     println!(">> Test-kernel: Trigger illegal exception");
-    unsafe { asm!("unimp") };
+    unsafe { asm!("csrw mcycle, x0") }; // mcycle cannot be written, this is always a 4-byte illegal instruction
     println!("<< Test-kernel: SBI test SUCCESS, shutdown");
     sbi::shutdown()
 }