@@ -3,12 +3,14 @@ use core::{
3
3
pin:: Pin ,
4
4
} ;
5
5
6
- use riscv:: register:: { mcause, mie, mip, scause:: { Exception , Trap } } ;
7
- use riscv:: register:: scause:: Interrupt ;
6
+ use riscv:: register:: {
7
+ mcause, mie, mip,
8
+ scause:: { Exception , Interrupt , Trap } ,
9
+ } ;
8
10
9
11
use crate :: feature;
10
12
use crate :: prv_mem:: { self , SupervisorPointer } ;
11
- use crate :: qemu_hsm:: { HsmCommand , pause , QemuHsm } ;
13
+ use crate :: qemu_hsm:: { pause , HsmCommand , QemuHsm } ;
12
14
use crate :: runtime:: { MachineTrap , Runtime , SupervisorContext } ;
13
15
14
16
pub fn execute_supervisor ( supervisor_mepc : usize , hart_id : usize , a1 : usize , hsm : QemuHsm ) -> ! {
@@ -102,10 +104,7 @@ pub fn execute_supervisor(supervisor_mepc: usize, hart_id: usize, a1: usize, hsm
102
104
let clint = crate :: clint:: Clint :: new ( 0x2000000 as * mut u8 ) ;
103
105
clint. clear_soft ( hart_id) ; // Clear IPI
104
106
if feature:: should_transfer_trap ( ctx) {
105
- feature:: do_transfer_trap (
106
- ctx,
107
- Trap :: Interrupt ( Interrupt :: SupervisorSoft ) ,
108
- )
107
+ feature:: do_transfer_trap ( ctx, Trap :: Interrupt ( Interrupt :: SupervisorSoft ) )
109
108
} else {
110
109
panic ! ( "rustsbi-qemu: machine soft interrupt with no hart state monitor command" )
111
110
}
@@ -140,7 +139,13 @@ fn fail_illegal_instruction(ctx: &mut SupervisorContext, ins: usize) -> ! {
140
139
141
140
fn fail_cant_read_exception_address ( ctx : & mut SupervisorContext , cause : mcause:: Exception ) -> ! {
142
141
#[ cfg( target_pointer_width = "64" ) ]
143
- panic ! ( "can't read exception address, cause: {:?}, mepc: {:016x?}, context: {:016x?}" , cause, ctx. mepc, ctx) ;
142
+ panic ! (
143
+ "can't read exception address, cause: {:?}, mepc: {:016x?}, context: {:016x?}" ,
144
+ cause, ctx. mepc, ctx
145
+ ) ;
144
146
#[ cfg( target_pointer_width = "32" ) ]
145
- panic ! ( "can't read exception address, cause: {:?}, mepc: {:08x?}, context: {:08x?}" , cause, ctx. mepc, ctx) ;
147
+ panic ! (
148
+ "can't read exception address, cause: {:?}, mepc: {:08x?}, context: {:08x?}" ,
149
+ cause, ctx. mepc, ctx
150
+ ) ;
146
151
}
0 commit comments