Add a threading syscall API.

This commit is contained in:
Drew Galbraith 2023-06-06 16:24:03 -07:00
parent e2aad55a8a
commit ef8eb5d993
14 changed files with 235 additions and 30 deletions

View file

@ -7,6 +7,7 @@
#define ZC_WRITE 0x01
#define ZC_READ 0x02
// Process Calls.
#define Z_PROCESS_EXIT 0x01
#define Z_PROCESS_SPAWN 0x02
#define Z_PROCESS_START 0x03
@ -16,10 +17,14 @@
#define ZC_PROC_SPAWN_PROC 0x100
#define ZC_PROC_SPAWN_THREAD 0x101
#define Z_INIT_PROC_SELF 0x1
// Thread Calls.
#define Z_THREAD_CREATE 0x10
#define Z_THREAD_START 0x11
#define Z_THREAD_EXIT 0x12
// Debugging Calls.
#define Z_DEBUG_PRINT 0x10000000
uint64_t ZDebug(const char* message);
@ -31,5 +36,29 @@ struct ZProcessSpawnElfReq {
uint64_t elf_size;
};
// Creates a child process of the current one and
// starts its root thread from the provided ELF file.
uint64_t ZProcessSpawnElf(uint64_t cap_id, uint64_t elf_base,
uint64_t elf_size);
struct ZThreadCreateReq {
uint64_t proc_cap;
};
struct ZThreadCreateResp {
uint64_t thread_cap;
};
uint64_t ZThreadCreate(uint64_t proc_cap, uint64_t* thread_cap);
struct ZThreadStartReq {
uint64_t thread_cap;
uint64_t entry;
uint64_t arg1;
uint64_t arg2;
};
uint64_t ZThreadStart(uint64_t thread_cap, uint64_t entry, uint64_t arg1,
uint64_t arg2);
void ZThreadExit();