From 5890df7bf838a5a912465a1bba02e5d8cf34e33c Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sat, 2 Nov 2024 18:58:13 +0200 Subject: allow skipping some cache flushes in proc --- include/arch/proc.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'include') diff --git a/include/arch/proc.h b/include/arch/proc.h index b0f0944..ec01a55 100644 --- a/include/arch/proc.h +++ b/include/arch/proc.h @@ -7,6 +7,11 @@ /** * @file proc.h * Arch-specific process related stuff. + * + * Note that all functions except *_fast may not assume that the rpc stack is + * mapped into the current address space, so they might have to do some extra + * calculations to find the underlying physical stack or something along those + * lines. */ #if defined(__riscv) @@ -29,6 +34,16 @@ */ void set_ret(struct tcb *t, size_t n, struct sys_ret a); +/** + * Attach argument data to thread, to be returned to userspace. + * Must only be called when cur_tcb() == t. Currently only used by do_ipc() so + * no need to figure out how many registers to set, just set them all. + * + * @param t Current thread. + * @param a Values to place in return registers. + */ +void set_ret_fast(struct tcb *t, struct sys_ret a); + /** * Get argument data attached to thread. * To some extent a hack, used by swap. @@ -61,6 +76,16 @@ void set_thread(struct tcb *t); */ void set_stack(struct tcb *t, vm_t s); +/** + * Set userspace stack, but do it very quickly. + * Must only be called when cur_tcb() == t, allowing us to do a fast but 'unsafe' + * direct write to the rpc stack. + * + * @param t Current thread. + * @param s Address to place into the stack register. + */ +void set_stack_fast(struct tcb *t, vm_t s); + /** * Get current userspace stack. * -- cgit v1.3