switch/case for get_trap_action
This commit is contained in:
parent
a3f651b986
commit
e883822ccc
1 changed files with 27 additions and 19 deletions
30
mmu.cpp
30
mmu.cpp
|
@ -270,27 +270,35 @@ std::pair<trap_action_t, int> mmu::get_trap_action(const int run_mode, const boo
|
|||
|
||||
trap_action_t trap_action = T_PROCEED;
|
||||
|
||||
if (access_control == 0)
|
||||
switch(access_control) {
|
||||
case 0:
|
||||
trap_action = T_ABORT_4;
|
||||
else if (access_control == 1)
|
||||
break;
|
||||
case 1:
|
||||
trap_action = is_write ? T_ABORT_4 : T_TRAP_250;
|
||||
else if (access_control == 2) {
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (is_write)
|
||||
trap_action = T_ABORT_4;
|
||||
}
|
||||
else if (access_control == 3)
|
||||
break;
|
||||
case 3:
|
||||
trap_action = T_ABORT_4;
|
||||
else if (access_control == 4)
|
||||
break;
|
||||
case 4:
|
||||
trap_action = T_TRAP_250;
|
||||
else if (access_control == 5) {
|
||||
break;
|
||||
case 5:
|
||||
if (is_write)
|
||||
trap_action = T_TRAP_250;
|
||||
}
|
||||
else if (access_control == 6) {
|
||||
break;
|
||||
case 6:
|
||||
// proceed
|
||||
}
|
||||
else if (access_control == 7) {
|
||||
break;
|
||||
|
||||
case 7:
|
||||
trap_action = T_ABORT_4;
|
||||
break;
|
||||
}
|
||||
|
||||
return { trap_action, access_control };
|
||||
|
|
Loading…
Add table
Reference in a new issue