Commit 4179e7b2 authored by Stephanie Gawroriski's avatar Stephanie Gawroriski
Browse files

Forward IPC calls in Java SE.

parent e5f5f4fc
......@@ -1958,7 +1958,23 @@ public final class Assembly
// IPC Call
case SystemCallIndex.IPC_CALL:
throw new todo.TODO();
try
{
return IPCManager.ipcCall(0, __args);
}
catch (RuntimeException e)
{
// Debug this
e.printStackTrace();
// Store class name caught
__data.exception = Assembly.__uniqueStringId(
e.getClass().getName().replace('.', '/'));
// Fail
throw new SystemCallException(
SystemCallError.IPC_ERROR);
}
// Loads a string
case SystemCallIndex.LOAD_STRING:
......
......@@ -529,6 +529,9 @@ extern "C"
/** End of file. */
#define SJME_SYSCALL_ERROR_END_OF_FILE SJME_JINT_C(-9)
/** IPC Error. */
#define SJME_SYSCALL_ERROR_IPC_ERROR SJME_JINT_C(-10)
/*****************************************************************************
***************************** PIPE DESCRIPTORS *******************************
*****************************************************************************/
......
......@@ -70,6 +70,65 @@ public final class IPCManager
__g, __h);
}
/**
* This is the handler for IPC messages, which performs unfolding
* accordingly.
*
* @param __tid The origin task ID.
* @param __v Input values.
* @return The result of the IPC call.
* @throws NullPointerException On null arguments.
* @since 2019/12/28
*/
public static final long ipcCall(int __tid, int... __v)
throws NullPointerException
{
if (__v == null)
throw new NullPointerException("NARG");
int n = __v.length;
return IPCManager.ipcCall(__tid,
(0 < n ? __v[0] : 0),
(1 < n ? __v[1] : 0),
(2 < n ? __v[2] : 0),
(3 < n ? __v[3] : 0),
(4 < n ? __v[4] : 0),
(5 < n ? __v[5] : 0),
(6 < n ? __v[6] : 0),
(7 < n ? __v[7] : 0),
(8 < n ? __v[8] : 0));
}
/**
* This is the handler for IPC messages, which performs unfolding
* accordingly.
*
* @param __tid The origin task ID.
* @param __ipcid The ID number of the IPC interface.
* @param __v Input values.
* @return The result of the IPC call.
* @throws NullPointerException On null arguments.
* @since 2019/12/28
*/
public static final long ipcCall(int __tid, int __ipcid, int... __v)
throws NullPointerException
{
if (__v == null)
throw new NullPointerException("NARG");
int n = __v.length;
return IPCManager.ipcCall(__tid,
__ipcid,
(0 < n ? __v[0] : 0),
(1 < n ? __v[1] : 0),
(2 < n ? __v[2] : 0),
(3 < n ? __v[3] : 0),
(4 < n ? __v[4] : 0),
(5 < n ? __v[5] : 0),
(6 < n ? __v[6] : 0),
(7 < n ? __v[7] : 0));
}
/**
* Registers the given ID with the specified callback.
*
......
......@@ -56,6 +56,10 @@ public final class SystemCallError
public static final byte END_OF_FILE =
-9;
/** Error with IPC Call. */
public static final byte IPC_ERROR =
-10;
/**
* Not used.
*
......
......@@ -56,6 +56,10 @@ public final class SystemCallError
public static final byte END_OF_FILE =
-9;
/** Error with IPC Call. */
public static final byte IPC_ERROR =
-10;
/**
* Not used.
*
......
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