From 2d9f95395955f2d645d15a9da0fbb8712a3b711a Mon Sep 17 00:00:00 2001 From: Folkert van Heusden Date: Wed, 26 Jun 2024 20:41:44 +0200 Subject: [PATCH 1/5] sleep while locked --- comm_tcp_socket_client.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/comm_tcp_socket_client.cpp b/comm_tcp_socket_client.cpp index 0f06cfb..b4035f1 100644 --- a/comm_tcp_socket_client.cpp +++ b/comm_tcp_socket_client.cpp @@ -157,7 +157,6 @@ void comm_tcp_socket_client::operator()() DOLOG(ll_error, true, "comm_tcp_socket_client: cannot resolve \"%s\":%s: %s", host.c_str(), port_str, gai_strerror(rc)); #endif - myusleep(101000l); continue; } From 70c64ddcd21a83f58f9f3f31b85e86fba457de83 Mon Sep 17 00:00:00 2001 From: Folkert van Heusden Date: Wed, 26 Jun 2024 20:46:21 +0200 Subject: [PATCH 2/5] race for cond.var. --- cpu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu.cpp b/cpu.cpp index c8c76d4..1d02c24 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -1685,7 +1685,7 @@ bool cpu::misc_operations(const uint16_t instr) #else std::unique_lock lck(qi_lock); - if (check_pending_interrupts() == false) + while (check_pending_interrupts() == false) qi_cv.wait(lck); #endif uint64_t end = get_us(); From cc38bd8b1714649bdc6caa7e9304f1e469e853e8 Mon Sep 17 00:00:00 2001 From: Folkert van Heusden Date: Wed, 26 Jun 2024 20:51:20 +0200 Subject: [PATCH 3/5] race in kw11-l --- kw11-l.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kw11-l.cpp b/kw11-l.cpp index f044f84..863438e 100644 --- a/kw11-l.cpp +++ b/kw11-l.cpp @@ -181,6 +181,11 @@ void kw11_l::write_byte(const uint16_t addr, const uint8_t value) return; } +#if defined(BUILD_FOR_RP2040) + xSemaphoreTake(lf_csr_lock, portMAX_DELAY); +#else + std::unique_lock lck(lf_csr_lock); +#endif uint16_t vtemp = lf_csr; if (addr & 1) { From f7896669aa0433090dd3c6988bcf2429a0e8878f Mon Sep 17 00:00:00 2001 From: Folkert van Heusden Date: Wed, 26 Jun 2024 20:53:34 +0200 Subject: [PATCH 4/5] race in kw11-l --- kw11-l.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kw11-l.cpp b/kw11-l.cpp index 863438e..8aef37d 100644 --- a/kw11-l.cpp +++ b/kw11-l.cpp @@ -67,6 +67,11 @@ void kw11_l::begin(console *const cnsl) void kw11_l::reset() { +#if defined(BUILD_FOR_RP2040) + xSemaphoreTake(lf_csr_lock, portMAX_DELAY); +#else + std::unique_lock lck(lf_csr_lock); +#endif lf_csr = 0; } From 5e2c8a7f57767220b5dad23bc8ea28bb9293efc7 Mon Sep 17 00:00:00 2001 From: Folkert van Heusden Date: Wed, 26 Jun 2024 20:55:20 +0200 Subject: [PATCH 5/5] no longer used --- cpu.h | 1 - 1 file changed, 1 deletion(-) diff --git a/cpu.h b/cpu.h index 1d5ce10..d05e764 100644 --- a/cpu.h +++ b/cpu.h @@ -148,7 +148,6 @@ class cpu void init_interrupt_queue(); void queue_interrupt(const uint8_t level, const uint8_t vector); std::map > get_queued_interrupts() const { return queued_interrupts; } - std::optional get_interrupt_delay_left() const { return trap_delay; } bool check_if_interrupts_pending() const { return any_queued_interrupts; } void trap(uint16_t vector, const int new_ipl = -1, const bool is_interrupt = false);