From a12e50e5a7dae52ed8bd5a24cc6576371e20985b Mon Sep 17 00:00:00 2001 From: Kimplul Date: Mon, 27 Dec 2021 20:40:44 +0200 Subject: Started work on syscalls --- common/uapi/mem.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 common/uapi/mem.c (limited to 'common/uapi/mem.c') diff --git a/common/uapi/mem.c b/common/uapi/mem.c new file mode 100644 index 0000000..34ddda2 --- /dev/null +++ b/common/uapi/mem.c @@ -0,0 +1,45 @@ +#include +#include +#include + +vm_t sys_req_mem(vm_t size, vm_t flags, vm_t u0, vm_t u1) +{ + UNUSED(u0); UNUSED(u1); + /* proc_tcb should give the tcb of the TID currently running */ + struct tcb *r = cur_tcb(); + return alloc_uvmem(r, size, flags); +} + +vm_t sys_req_fixmem(vm_t start, vm_t size, vm_t flags, vm_t u0) +{ + UNUSED(u0); + struct tcb *r = cur_tcb(); + return alloc_fixed_uvmem(r, start, size, flags); +} + +vm_t sys_free_mem(vm_t start, vm_t u0, vm_t u1, vm_t u2) +{ + UNUSED(u0); UNUSED(u1); UNUSED(u2); + struct tcb *r = cur_tcb(); + free_uvmem(r, start); + return 0; +} + +vm_t sys_req_pmem(vm_t paddr, vm_t size, vm_t flags, vm_t u0) +{ + UNUSED(u0); + /* this will require some pondering, but essentially this syscall should + * only be used for device access, so any addresses requested should be + * outside the RAM area, and I'll probably have to implement some method + * that keeps track of used regions outside of RAM. We'll see. + */ + return 0; +} + +vm_t sys_req_sharedmem(vm_t pid, vm_t start, vm_t size, vm_t flags) +{ + /* take memory in PID's vaddr and map it somewhere in our own memory + * region. + */ + return 0; +} -- cgit v1.3