4
0
Эх сурвалжийг харах

Small fix for illegal instruction testcase

luojia65 4 жил өмнө
parent
commit
24bf4e39ec

+ 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,
 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.
 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
 ## 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
 [rustsbi] Kernel entry: 0x80200000
 << Test-kernel: Hart id = 0, DTB physical address = 0x1020
 << Test-kernel: Hart id = 0, DTB physical address = 0x1020
 >> Test-kernel: Trigger illegal exception
 >> 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);
     println!("<< Test-kernel: Hart id = {}, DTB physical address = {:#x}", hartid, dtb_pa);
     unsafe { stvec::write(start_trap as usize, TrapMode::Direct) };
     unsafe { stvec::write(start_trap as usize, TrapMode::Direct) };
     println!(">> Test-kernel: Trigger illegal exception");
     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");
     println!("<< Test-kernel: SBI test SUCCESS, shutdown");
     sbi::shutdown()
     sbi::shutdown()
 }
 }