queued interrupts were not stored
This commit is contained in:
parent
0a2f508e61
commit
7c0133dc8d
4 changed files with 40 additions and 7 deletions
24
cpu.cpp
24
cpu.cpp
|
@ -2423,6 +2423,18 @@ json_t *cpu::serialize()
|
|||
if (trap_delay.has_value())
|
||||
json_object_set(j, "trap_delay", json_integer(trap_delay.value()));
|
||||
|
||||
json_t *j_queued_interrupts = json_object();
|
||||
for(auto & il: queued_interrupts) {
|
||||
json_t *ja_qi_level = json_array();
|
||||
for(auto & v: il.second)
|
||||
json_array_append(ja_qi_level, json_integer(v));
|
||||
|
||||
json_object_set(j_queued_interrupts, format("%d", il.first).c_str(), ja_qi_level);
|
||||
}
|
||||
json_object_set(j, "queued_interrupts", j_queued_interrupts);
|
||||
|
||||
json_object_set(j, "any_queued_interrupts", json_boolean(any_queued_interrupts));
|
||||
|
||||
return j;
|
||||
}
|
||||
|
||||
|
@ -2454,6 +2466,18 @@ cpu *cpu::deserialize(const json_t *const j, bus *const b, std::atomic_uint32_t
|
|||
c->trap_delay = json_integer_value(temp);
|
||||
else
|
||||
c->trap_delay.reset();
|
||||
c->any_queued_interrupts = json_boolean_value(json_object_get(j, "any_queued_interrupts"));
|
||||
|
||||
c->init_interrupt_queue();
|
||||
json_t *j_queued_interrupts = json_object_get(j, "queued_interrupts");
|
||||
for(int level=0; level<8; level++) {
|
||||
auto it = c->queued_interrupts.find(level);
|
||||
|
||||
json_t *ja_qi_level = json_object_get(j_queued_interrupts, format("%d", level).c_str());
|
||||
|
||||
for(size_t i=0; i<json_array_size(ja_qi_level); i++)
|
||||
it->second.insert(json_integer_value(json_array_get(ja_qi_level, i)));
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
|
2
cpu.h
2
cpu.h
|
@ -62,6 +62,7 @@ private:
|
|||
|
||||
// level, vector
|
||||
std::map<uint8_t, std::set<uint8_t> > queued_interrupts;
|
||||
std::atomic_bool any_queued_interrupts { false };
|
||||
#if defined(BUILD_FOR_RP2040)
|
||||
SemaphoreHandle_t qi_lock { xSemaphoreCreateBinary() };
|
||||
QueueHandle_t qi_q { xQueueCreate(16, 1) };
|
||||
|
@ -69,7 +70,6 @@ private:
|
|||
std::mutex qi_lock;
|
||||
std::condition_variable qi_cv;
|
||||
#endif
|
||||
std::atomic_bool any_queued_interrupts { false };
|
||||
|
||||
std::map<int, breakpoint *> breakpoints;
|
||||
int bp_nr { 0 };
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// (C) 2018-2024 by Folkert van Heusden
|
||||
// Released under MIT license
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "disk_backend.h"
|
||||
#include "disk_backend_file.h"
|
||||
#include "disk_backend_nbd.h"
|
||||
|
@ -19,15 +21,19 @@ disk_backend *disk_backend::deserialize(const json_t *const j)
|
|||
{
|
||||
std::string type = json_string_value(json_object_get(j, "disk-backend-type"));
|
||||
|
||||
if (type == "file")
|
||||
return disk_backend_file::deserialize(j);
|
||||
disk_backend *d = nullptr;
|
||||
|
||||
if (type == "nbd")
|
||||
return disk_backend_nbd::deserialize(j);
|
||||
if (type == "file")
|
||||
d = disk_backend_file::deserialize(j);
|
||||
|
||||
else if (type == "nbd")
|
||||
d = disk_backend_nbd::deserialize(j);
|
||||
|
||||
// should not be reached
|
||||
assert(false);
|
||||
assert(d);
|
||||
|
||||
return nullptr;
|
||||
d->begin();
|
||||
|
||||
return d;
|
||||
}
|
||||
#endif
|
||||
|
|
3
main.cpp
3
main.cpp
|
@ -570,6 +570,9 @@ int main(int argc, char *argv[])
|
|||
b = bus::deserialize(j, cnsl, &event);
|
||||
|
||||
json_decref(j);
|
||||
|
||||
DOLOG(warning, true, "DO NOT FORGET TO DELETE AND NOT TO RE-USE THE STATE FILE (\"%s\")! (unless updated)", deserialize.c_str());
|
||||
myusleep(251000);
|
||||
}
|
||||
|
||||
if (b->getTty() == nullptr) {
|
||||
|
|
Loading…
Add table
Reference in a new issue