fixes mstatus mask

This commit is contained in:
Eyck Jentzsch 2023-03-25 09:14:56 +01:00
parent 8e1951f298
commit 2e4faa4d50
1 changed files with 16 additions and 2 deletions

View File

@ -219,7 +219,7 @@ public:
mstatus_t mstatus; mstatus_t mstatus;
static const reg_t mstatus_reset_val = 0xa00000000; static const reg_t mstatus_reset_val = 0x1800;
void write_mstatus(T val) { void write_mstatus(T val) {
auto mask = get_mask() &0xff; // MPP is hardcode as 0x3 auto mask = get_mask() &0xff; // MPP is hardcode as 0x3
@ -228,7 +228,21 @@ public:
} }
static constexpr T get_mask() { static constexpr T get_mask() {
return 0x8000000f007ff9ddULL; // 0b1...0 1111 0000 0000 0111 1111 1111 1001 1011 1011 //return 0x8000000f007ff9ddULL; // 0b1...0 1111 0000 0000 0111 1111 1111 1001 1011 1011
//
// +-TSR
// |+-TW
// ||+-TVM
// |||+-MXR
// ||||+-SUM
// |||||+-MPRV
// |||||| +-XS
// |||||| | +-FS
// |||||| | | +-MPP
// |||||| | | | +-SPP
// |||||| | | | |+-MPIE
// ||||||/|/|/| || +-MIE
return 0b00000000000000000001100010001000;
} }
}; };