Commit ae225d52 authored by Stephanie Gawroriski's avatar Stephanie Gawroriski
Browse files

Implement EXCEPTION_LOAD/EXCEPTION_STORE in SummerCoat; Make IPC_CALL always...

Implement EXCEPTION_LOAD/EXCEPTION_STORE in SummerCoat; Make IPC_CALL always call the supervisor handler even within the supervisor.
parent 2a7e4162
......@@ -1643,9 +1643,11 @@ sjme_jint sjme_cpuexec(sjme_jvm* jvm, sjme_cpu* cpu, sjme_error* error,
/* Call it and place result into the return register. */
/* IPC Exceptions are not forwarded to supervisor. */
if (cpu->state.taskid == 0 ||
/* IPC Calls are always virtualized even in supervisor. */
if ((cpu->state.taskid == 0 ||
ia == SJME_SYSCALL_EXCEPTION_LOAD ||
ia == SJME_SYSCALL_EXCEPTION_STORE)
ia == SJME_SYSCALL_EXCEPTION_STORE) &&
ia != SJME_SYSCALL_IPC_CALL)
{
/* Reset */
longcombine.lo = 0;
......
......@@ -105,6 +105,9 @@ public final class NativeCPU
private final Deque<Deque<ExecutionSlice>> _sopf =
(ENABLE_DEBUG ? new LinkedList<Deque<ExecutionSlice>>() : null);
/** IPC Exception register. */
private int _ipcexception;
/**
* Initializes the native CPU.
*
......@@ -941,10 +944,12 @@ public final class NativeCPU
// Handle system call as is from the supervisor
// IPC Exception load/store is not included
// IPC Calls are always virtualized even in supervisor.
Frame was = frames.getLast();
if (was._taskid == 0 ||
if ((was._taskid == 0 ||
syscallid == SystemCallIndex.EXCEPTION_LOAD ||
syscallid == SystemCallIndex.EXCEPTION_STORE)
syscallid == SystemCallIndex.EXCEPTION_STORE) &&
syscallid != SystemCallIndex.IPC_CALL)
{
// If profiling, profile the handling of the
// system call in a sub-frame
......@@ -1249,6 +1254,8 @@ public final class NativeCPU
case SystemCallIndex.BYTE_ORDER_LITTLE:
case SystemCallIndex.ERROR_GET:
case SystemCallIndex.ERROR_SET:
case SystemCallIndex.EXCEPTION_LOAD:
case SystemCallIndex.EXCEPTION_STORE:
case SystemCallIndex.FATAL_TODO:
case SystemCallIndex.FRAME_TASK_ID_GET:
case SystemCallIndex.FRAME_TASK_ID_SET:
......@@ -1398,6 +1405,19 @@ public final class NativeCPU
}
break;
// IPC Exception load
case SystemCallIndex.EXCEPTION_LOAD:
rv = this._ipcexception;
err = 0;
break;
// IPC Exception store
case SystemCallIndex.EXCEPTION_STORE:
rv = this._ipcexception;
this._ipcexception = __args[0];
err = 0;
break;
// Fatal exit because of incomplete code
case SystemCallIndex.FATAL_TODO:
// {@squirreljme.error AE0o Fatal ToDo system call executed.}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment