Skip to content
Snippets Groups Projects
Commit 6db60457 authored by rahix's avatar rahix
Browse files

fix(core1-control): Free semaphore between ready waiting and loading

Up to now, the semaphore was locked in core1_wait_ready() and later
freed in core1_load().  This is problematic when only core1_wait_ready()
is called (e.g. due to an invalid payload).

Instead, free the semaphore before leaving core1_wait_ready() and
reaquire it in core1_load().  This way an incorrect call sequence cannot
lead to a lockup.

Ref: #228
parent 685985d6
No related branches found
No related tags found
1 merge request!445Fix lockup when attempting to load a l0dable with disabled ELF loading
......@@ -227,6 +227,7 @@ void core1_wait_ready(void)
* above loop, waiting for a new IVT.
*/
if (core1_info.ready) {
SEMA_FreeSema(_CONTROL_SEMAPHORE);
break;
}
......@@ -245,6 +246,9 @@ void core1_wait_ready(void)
void core1_load(void *ivt, char *args)
{
while (SEMA_GetSema(_CONTROL_SEMAPHORE) == E_BUSY) {
}
/* If the core is currently in an API call, reset it. */
API_CALL_MEM->call_flag = _API_FLAG_IDLE;
API_CALL_MEM->id = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment