[zion] Handle syscall cases by macro as well.

This commit is contained in:
Drew Galbraith 2023-06-20 13:50:18 -07:00
parent 5fc7296b20
commit 76107b7db7
3 changed files with 23 additions and 17 deletions

View file

@ -4,7 +4,7 @@
#include "ztypes.h"
#define SYS1(name, num, t1, a1) \
#define SYS1(name, t1, a1) \
struct Z##name##Req { \
t1 a1; \
}; \
@ -12,10 +12,10 @@
Z##name##Req req{ \
.a1 = a1, \
}; \
return SysCall1(num, &req); \
return SysCall1(kZion##name, &req); \
}
#define SYS2(name, num, t1, a1, t2, a2) \
#define SYS2(name, t1, a1, t2, a2) \
struct Z##name##Req { \
t1 a1; \
t2 a2; \
@ -25,12 +25,12 @@
.a1 = a1, \
.a2 = a2, \
}; \
return SysCall1(num, &req); \
return SysCall1(kZion##name, &req); \
}
z_err_t SysCall1(uint64_t code, const void* req);
SYS1(ProcessExit, Z_PROCESS_EXIT, uint64_t, code);
SYS1(ProcessExit, uint64_t, code);
[[nodiscard]] z_err_t ZProcessSpawn(z_cap_t proc_cap, z_cap_t bootstrap_cap,
z_cap_t* new_proc_cap,
@ -42,7 +42,7 @@ SYS1(ProcessExit, Z_PROCESS_EXIT, uint64_t, code);
uint64_t entry, uint64_t arg1,
uint64_t arg2);
SYS2(ThreadCreate, Z_THREAD_CREATE, z_cap_t, proc_cap, z_cap_t*, thread_cap);
SYS2(ThreadCreate, z_cap_t, proc_cap, z_cap_t*, thread_cap);
[[nodiscard]] z_err_t ZThreadStart(z_cap_t thread_cap, uint64_t entry,
uint64_t arg1, uint64_t arg2);

View file

@ -30,12 +30,12 @@ typedef uint64_t z_err_t;
* ------------------------------*/
// Process Calls.
#define Z_PROCESS_EXIT 0x01
const uint64_t kZionProcessExit = 0x1;
#define Z_PROCESS_SPAWN 0x02
#define Z_PROCESS_START 0x03
// Thread Calls.
#define Z_THREAD_CREATE 0x10
const uint64_t kZionThreadCreate = 0x10;
#define Z_THREAD_START 0x11
#define Z_THREAD_EXIT 0x12