MMR0
This commit is contained in:
parent
a90547c3d1
commit
87e181a8e2
1 changed files with 22 additions and 10 deletions
12
bus.cpp
12
bus.cpp
|
@ -332,6 +332,7 @@ uint32_t bus::calculate_physical_address(const int run_mode, const uint16_t a, c
|
|||
m_offset += p_offset;
|
||||
|
||||
if (trap_on_failure) {
|
||||
if (MMR0 & (1 << 9)) {
|
||||
int access_control = pages[run_mode][0][apf].pdr & 7;
|
||||
|
||||
if (is_write && access_control != 6) { // write
|
||||
|
@ -339,6 +340,11 @@ uint32_t bus::calculate_physical_address(const int run_mode, const uint16_t a, c
|
|||
|
||||
pages[run_mode][0][apf].pdr |= 1 << 7; // TODO: D/I
|
||||
|
||||
MMR0 |= 1 << 12;
|
||||
|
||||
MMR0 &= ~(3 << 5);
|
||||
MMR0 |= run_mode << 5; // TODO: kernel-mode or user-mode when a trap occurs in user-mode?
|
||||
|
||||
throw 1;
|
||||
}
|
||||
else if (!is_write) { // read
|
||||
|
@ -347,9 +353,15 @@ uint32_t bus::calculate_physical_address(const int run_mode, const uint16_t a, c
|
|||
|
||||
pages[run_mode][0][apf].pdr |= 1 << 7; // TODO: D/I
|
||||
|
||||
MMR0 |= 1 << 12;
|
||||
|
||||
MMR0 &= ~(3 << 5);
|
||||
MMR0 |= run_mode << 5;
|
||||
|
||||
throw 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t pdr_len = (((pages[run_mode][0][apf].pdr >> 8) & 127) + 1) * 64; // TODO: D/I
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue