Additionally, I've implemented a function that waits for IPC data on either a specified port or any port called waitipc:
Code: Select all
void waitipc(uint32_t port) {
if (!verify_ipc_port_ownership(port))
yield();
dprintf("Port is %u\n", port);
current_task->state = TASK_STATE_WAITIPC;
current_task->waitval = port;
dprintf("Port is %u\n", current_task->waitval);
yield();
}
At this point it acts like it assigns the value of port to the current task's waitval, but it actually does NOTHING.
The first dprintf (debug printf, goes to serial) says "Port is 24576" (which is correct as it is supposed to wait for port 0x6000).
The second dprintf says "Port is 0" which is wrong, even though it is set in the line before it!
I've verified this with GDB too.
What could be the cause of this? Is it being optimized out somehow?
(Note: I will try to upload the full code to GitHub soon)