From 9c0f26d26366ff7def20d5be6aff5e0f93976ad6 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sat, 6 Jul 2024 20:50:36 +0300 Subject: adjust stack handling --- include/arch/tcb.h | 7 +++++++ include/kmi/tcb.h | 16 +++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/arch/tcb.h b/include/arch/tcb.h index 931b800..b8b0961 100644 --- a/include/arch/tcb.h +++ b/include/arch/tcb.h @@ -41,6 +41,13 @@ void setup_rpc_stack(struct tcb *t); */ void destroy_rpc_stack(struct tcb *t); +/** + * Reset RPC stack to top. + * + * @param t Thread whose RPC stack should be reset. + */ +void reset_rpc_stack(struct tcb *t); + /** * @return Max size of one individual RPC stack instance. */ diff --git a/include/kmi/tcb.h b/include/kmi/tcb.h index b7fd3d6..a06d801 100644 --- a/include/kmi/tcb.h +++ b/include/kmi/tcb.h @@ -122,18 +122,13 @@ struct tcb { vm_t thread_stack; /** Address of this thread's stack top. */ - vm_t thread_stack_top; + vm_t thread_stack_size; /** Current address of usable rpc stack. */ vm_t rpc_stack; - /** \todo Check if each thread should be allowed more than just one - * region of thread local storage. */ - /** Possible thread local storage. */ - vm_t thread_storage; - /** Reference count to process. */ - atomic_int_fast32_t refcount; + long refcount; /** Process context of thread. */ struct tcb_ctx proc; @@ -321,6 +316,13 @@ struct tcb *get_tcb(id_t tid); */ stat_t alloc_stack(struct tcb *t); +/** + * Free thread stack. + * + * @param t Thread whose stack to free. + */ +void free_stack(struct tcb *t); + /** * Set address to jump to when returning to userspace. * -- cgit v1.3