aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-12-01 02:05:19 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2022-12-01 02:05:19 +0200
commit131af4eec38752a27e6e56579fbf76178e022ec1 (patch)
tree1940634f69a44395fc6945b25c5cbc8b68bba876 /include
parente25f1e7a8f8f2320546ad4950464713d85b47785 (diff)
downloadkmi-131af4eec38752a27e6e56579fbf76178e022ec1.tar.gz
kmi-131af4eec38752a27e6e56579fbf76178e022ec1.zip
start looking into memory handling
+ Now 10M alloc/frees succeed, which totals more memory than the virtual machine has, so no too obvious leaks are occuring. For future debugging speed, changed 10M to 1M. + Also quick fix to rpcs, stacks are now assigned. Not entirely sure why they worked before this, but good that I found it.
Diffstat (limited to 'include')
-rw-r--r--include/apos/syscalls.h3
-rw-r--r--include/apos/tcb.h5
-rw-r--r--include/apos/uapi.h8
-rw-r--r--include/arch/proc.h9
4 files changed, 19 insertions, 6 deletions
diff --git a/include/apos/syscalls.h b/include/apos/syscalls.h
index a5c805d..611765d 100644
--- a/include/apos/syscalls.h
+++ b/include/apos/syscalls.h
@@ -44,6 +44,9 @@ enum {
/** Request memory at fixed virtual address. */
SYS_REQ_FIXMEM,
+ /** Request shared memory. */
+ SYS_REQ_SHAREDMEM,
+
/** Free memory. */
SYS_FREE_MEM,
/** @} */
diff --git a/include/apos/tcb.h b/include/apos/tcb.h
index c56a2b3..9f10e2f 100644
--- a/include/apos/tcb.h
+++ b/include/apos/tcb.h
@@ -391,17 +391,18 @@ bool running(struct tcb *t);
/**
* Save thread context for rpc call.
+ * Assumes t->rpc is pointing to the correct virtual memory.
*
* @param t Thread whose context to save.
*/
-void save_context(struct tcb *t);
+void enter_rpc(struct tcb *t);
/**
* Load thread context from rpc call.
*
* @param t Thread whose context to restore.
*/
-void load_context(struct tcb *t);
+void leave_rpc(struct tcb *t);
/**
* Check that we have enough rpc stack.
diff --git a/include/apos/uapi.h b/include/apos/uapi.h
index 2a0dfcc..7bd00bb 100644
--- a/include/apos/uapi.h
+++ b/include/apos/uapi.h
@@ -363,15 +363,15 @@ SYSCALL_DECLARE3(req_fixmem, start, size, flags);
* (server) frees it.
*
* @param t Current tcb.
+ * @param tid Thread to share memory with.
* @param size Size of allocation.
- * @param flags Flags of allocation.
- * @param c Unused.
- * @param d Unused.
+ * @param sflags Flags of allocation for server, that is \p t.
+ * @param cflags Flags of allocation for client, that is \p tid.
* @param e Unused.
*
* Returns \ref OK and start of memory allocation.
*/
-SYSCALL_DECLARE2(req_sharedmem, size, flags);
+SYSCALL_DECLARE4(req_sharedmem, tid, size, sflags, cflags);
/**
* Reference shared memory syscall.
diff --git a/include/arch/proc.h b/include/arch/proc.h
index 6a2c036..84954c0 100644
--- a/include/arch/proc.h
+++ b/include/arch/proc.h
@@ -49,6 +49,15 @@ struct sys_ret get_args(struct tcb *t);
void set_thread(struct tcb *t);
/**
+ * Set userspace stack. I think \ref set_thread() could be replaced with this,
+ * and it's more useful.
+ *
+ * @param t Thread whose stack to set.
+ * @param s Stack to give to thread.
+ */
+void set_stack(struct tcb *t, vm_t s);
+
+/**
* Get current userspace stack.
*
* @param t Thread whose stack to query.