File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ pub fn sstatus_read() -> usize {
127127pub fn flush_icache ( ) {
128128 riscv:: asm:: fence_i ( ) ;
129129
130- /// Flushes the instruction cache for T-Head C9xx cores.
130+ // Flushes the instruction cache for T-Head C9xx cores.
131131 #[ cfg( feature = "sg2002" ) ]
132132 unsafe {
133133 // Ensure instruction fetch sees latest memory contents.
Original file line number Diff line number Diff line change @@ -25,17 +25,27 @@ impl UserContext {
2525 /// Creates a new context with the given entry point, user stack pointer,
2626 /// and the argument.
2727 pub fn new ( entry : usize , ustack_top : VirtAddr , arg0 : usize ) -> Self {
28- let flags = 0 ;
29- #[ cfg( feature = "fp-simd" ) ]
30- let flags = ( 0x3 << 23 ) ; // sstatus.VS
31-
32- let mut sstatus = Sstatus :: from_bits ( 0 | flags) ;
28+ let mut sstatus = Sstatus :: from_bits ( 0 ) ;
3329 sstatus. set_spie ( true ) ; // enable interrupts
3430 sstatus. set_sum ( true ) ; // enable user memory access in supervisor mode
3531 #[ cfg( feature = "fp-simd" ) ]
3632 sstatus. set_fs ( FS :: Initial ) ; // set the FPU to initial state
33+ info ! (
34+ "UserContext new sstatus={:#x}, BITMASK={:#x}" ,
35+ sstatus. bits( ) ,
36+ Sstatus :: BITMASK
37+ ) ;
38+
39+ #[ cfg( feature = "sg2002" ) ]
40+ unsafe {
41+ let set_sstatus = & mut sstatus as * mut Sstatus as * mut usize ;
42+ let old_bits = * set_sstatus;
43+
44+ info ! ( "Setting sstatus.VS for sg2002" ) ;
45+ * set_sstatus = old_bits | ( 0x3 << 23 ) ;
46+ debug ! ( "Set sstatus new bits: {:#x}" , * set_sstatus) ;
47+ }
3748
38- debug ! ( "UserContext new sstatus={:#x}" , sstatus. bits( ) ) ;
3949 Self ( TrapFrame {
4050 regs : GeneralRegisters {
4151 a0 : arg0,
You can’t perform that action at this time.
0 commit comments