lock bits / get instruction can trap

This commit is contained in:
folkert van heusden 2023-03-23 12:44:06 +01:00
parent b184068789
commit 9ce5cb0bf6
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1
2 changed files with 11 additions and 19 deletions

12
bus.cpp
View file

@ -402,8 +402,7 @@ void bus::clearMMR0Bit(const int bit)
void bus::setMMR2(const uint16_t value)
{
if ((MMR0 & 0xe000) == 0)
MMR2 = value;
MMR2 = value;
}
void bus::check_odd_addressing(const uint16_t a, const int run_mode, const d_i_space_t space, const bool is_write)
@ -487,15 +486,14 @@ uint32_t bus::calculate_physical_address(const int run_mode, const uint16_t a, c
DOLOG(debug, true, "A.C.F. triggger for %d on address %06o, run mode %d", access_control, a, run_mode);
}
if (access_control == 1 || access_control == 4 || access_control == 5)
MMR0 |= 1 << 12; // set trap-flag
if (is_write)
pages[run_mode][d][apf].pdr |= 1 << 7;
if ((MMR0 & 0160000) == 0) {
MMR0 &= ~((1 << 15) | (1 << 14) | (1 << 13) | (3 << 5) | (7 << 1));
MMR0 |= 1 << 13; // read-only
MMR0 &= ~((1 << 15) | (1 << 14) | (1 << 13) | (1 << 12) | (3 << 5) | (7 << 1));
if (is_write && access_control != 6)
MMR0 |= 1 << 13; // read-only
//
if (access_control == 0 || access_control == 4)
MMR0 |= 1 << 15; // not resident

18
cpu.cpp
View file

@ -1615,17 +1615,11 @@ void cpu::trap(uint16_t vector, const int new_ipl, const bool is_interrupt)
if ((b->getMMR0() & 0160000) == 0) {
b->addToMMR1(-2, 6);
b->addToMMR1(-2, 6);
b->setMMR2(vector);
}
if (is_interrupt)
b->clearMMR0Bit(12);
else
b->setMMR0Bit(12); // it's a trap
}
// make sure the trap vector is retrieved from kernel space
psw &= 037777; // mask off 14/15
psw &= 037777; // mask off 14/15 TODO: still required? readWord gets a d_space parameter
setPC(b->readWord(vector + 0, d_space));
@ -2153,12 +2147,12 @@ void cpu::step_b()
{
instruction_count++;
uint16_t temp_pc = getPC();
if ((b->getMMR0() & 0160000) == 0)
b->setMMR2(temp_pc);
try {
uint16_t temp_pc = getPC();
if ((b->getMMR0() & 0160000) == 0)
b->setMMR2(temp_pc);
uint16_t instr = b->readWord(temp_pc);
if (temp_pc == 025250)