implemented real WAIT (really wait for interrupts)
This commit is contained in:
parent
ce1114a159
commit
9bba033dbc
2 changed files with 14 additions and 2 deletions
10
cpu.cpp
10
cpu.cpp
|
@ -289,6 +289,8 @@ void cpu::queue_interrupt(const uint8_t level, const uint8_t vector)
|
||||||
|
|
||||||
it->second.insert(vector);
|
it->second.insert(vector);
|
||||||
|
|
||||||
|
qi_cv.notify_all();
|
||||||
|
|
||||||
DOLOG(debug, true, "Queueing interrupt vector %o (IPL %d, current: %d), n: %zu", vector, level, getPSW_spl(), it->second.size());
|
DOLOG(debug, true, "Queueing interrupt vector %o (IPL %d, current: %d), n: %zu", vector, level, getPSW_spl(), it->second.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1485,6 +1487,14 @@ bool cpu::misc_operations(const uint16_t instr)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 0b0000000000000001: // WAIT
|
case 0b0000000000000001: // WAIT
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> lck(qi_lock);
|
||||||
|
|
||||||
|
qi_cv.wait(lck);
|
||||||
|
}
|
||||||
|
|
||||||
|
DOLOG(debug, false, "WAIT returned");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 0b0000000000000010: // RTI
|
case 0b0000000000000010: // RTI
|
||||||
|
|
4
cpu.h
4
cpu.h
|
@ -1,8 +1,9 @@
|
||||||
// (C) 2018-2022 by Folkert van Heusden
|
// (C) 2018-2023 by Folkert van Heusden
|
||||||
// Released under Apache License v2.0
|
// Released under Apache License v2.0
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <condition_variable>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
@ -40,6 +41,7 @@ private:
|
||||||
// level, vector
|
// level, vector
|
||||||
std::map<uint8_t, std::set<uint8_t> > queued_interrupts;
|
std::map<uint8_t, std::set<uint8_t> > queued_interrupts;
|
||||||
std::mutex qi_lock;
|
std::mutex qi_lock;
|
||||||
|
std::condition_variable qi_cv;
|
||||||
|
|
||||||
std::set<uint16_t> breakpoints;
|
std::set<uint16_t> breakpoints;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue