[zion] POC for defining syscalls using macros

This commit is contained in:
Drew Galbraith 2023-06-20 13:43:12 -07:00
parent 4fef54084f
commit 5fc7296b20
5 changed files with 36 additions and 32 deletions

View file

@ -8,6 +8,7 @@ _start:
_exit:
// EXIT syscall.
mov $1, %rdi
// Return code as a param.
mov %rax, %rsi
// Return code as a "struct" on the stack.
push %rax
mov %rsp, %rsi
syscall

View file

@ -19,10 +19,6 @@ z_err_t SysCall1(uint64_t number, const void* first) {
return SysCall2(number, first, 0);
}
void ZProcessExit(uint64_t code) {
SysCall1(Z_PROCESS_EXIT, reinterpret_cast<void*>(code));
}
z_err_t ZProcessSpawn(z_cap_t proc_cap, z_cap_t bootstrap_cap,
z_cap_t* new_proc_cap, z_cap_t* new_vmas_cap,
z_cap_t* new_bootstrap_cap) {
@ -38,16 +34,6 @@ z_err_t ZProcessSpawn(z_cap_t proc_cap, z_cap_t bootstrap_cap,
return ret;
}
z_err_t ZThreadCreate(z_cap_t proc_cap, z_cap_t* thread_cap) {
ZThreadCreateReq req{
.proc_cap = proc_cap,
};
ZThreadCreateResp resp;
z_err_t ret = SysCall2(Z_THREAD_CREATE, &req, &resp);
*thread_cap = resp.thread_cap;
return ret;
}
z_err_t ZThreadStart(z_cap_t thread_cap, uint64_t entry, uint64_t arg1,
uint64_t arg2) {
ZThreadStartReq req{

View file

@ -15,14 +15,6 @@ struct ZProcessSpawnResp {
z_cap_t bootstrap_cap;
};
struct ZThreadCreateReq {
z_cap_t proc_cap;
};
struct ZThreadCreateResp {
z_cap_t thread_cap;
};
struct ZThreadStartReq {
z_cap_t thread_cap;
uint64_t entry;