From a8540ed5cc382ac71716b9978862e57edf274d77 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Wed, 7 Jun 2023 21:46:49 +0300 Subject: slightly improve padding --- include/kmi/mem_regions.h | 15 +++++----- include/kmi/sp_tree.h | 6 ++-- include/kmi/tcb.h | 72 +++++++++++++++++++++++------------------------ 3 files changed, 47 insertions(+), 46 deletions(-) diff --git a/include/kmi/mem_regions.h b/include/kmi/mem_regions.h index 2e880f4..080a499 100644 --- a/include/kmi/mem_regions.h +++ b/include/kmi/mem_regions.h @@ -65,22 +65,23 @@ struct mem_region { /** Previous memory region by end address. */ struct mem_region *prev; - /** Memory region flags, both access as well as metadata. \see MR_USED, - * MR_SHARED, MR_OWNED, MR_COW, MR_KEEP. */ - vmflags_t flags; - /** End address of memory region. */ vm_t end; /** Start address of memory region. */ vm_t start; - /** In shared regions, mark the other pid that shared the region. */ - id_t pid; - /** In shared regions, this is the address associated with region in the * other process. */ vm_t alt_va; + + /** In shared regions, mark the other pid that shared the region. */ + id_t pid; + + /** Memory region flags, both access as well as metadata. \see MR_USED, + * MR_SHARED, MR_OWNED, MR_COW, MR_KEEP. */ + vmflags_t flags; + }; /** diff --git a/include/kmi/sp_tree.h b/include/kmi/sp_tree.h index 676329a..f1f9fca 100644 --- a/include/kmi/sp_tree.h +++ b/include/kmi/sp_tree.h @@ -87,9 +87,6 @@ * \see common/mem_region.c, for example. */ struct sp_node { - /** Hint. Approximate maximum tree height up to the current node. */ - int_fast16_t hint; - /** Lefthand node. */ struct sp_node *left; @@ -99,6 +96,9 @@ struct sp_node { /** Parent node. Technically speaking not necessary, but in this case I * went with time over space. */ struct sp_node *parent; + + /** Hint. Approximate maximum tree height up to the current node. */ + int_fast16_t hint; }; /** Convenience structure for trees. */ diff --git a/include/kmi/tcb.h b/include/kmi/tcb.h index b98b2cc..b7211e8 100644 --- a/include/kmi/tcb.h +++ b/include/kmi/tcb.h @@ -104,6 +104,42 @@ struct tcb { /** Memory mapping data. */ struct mem_region_root sp_r; + /** Address of callback function in servers. */ + vm_t callback; + + /** Address of this thread's stack base. */ + vm_t thread_stack; + + /** Address of this thread's stack top. */ + vm_t thread_stack_top; + + /** 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; + + /** Process context of thread. */ + struct tcb_ctx proc; + + /** RPC context of thread. */ + struct tcb_ctx rpc; + + /** + * RPC server context of thread. When a thread attaches itself to this + * process, its \ref rpc member is added to the list maintained in this + * variable. This allows the original thread to do rpc calls without + * messing up other threads' rpc status. + * + * I think, more testing required. + */ + struct tcb_ctx server; + + /** Notifcation state of thread. */ + enum tcb_notify notify_state; + /** * Effective process ID. * @@ -143,45 +179,9 @@ struct tcb { /** Cpu currently executing this thread. */ id_t cpu_id; - /** Address of callback function in servers. */ - vm_t callback; - /** Capabilities of thread. */ capflags_t caps; - /** Address of this thread's stack base. */ - vm_t thread_stack; - - /** Address of this thread's stack top. */ - vm_t thread_stack_top; - - /** 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; - - /** Process context of thread. */ - struct tcb_ctx proc; - - /** RPC context of thread. */ - struct tcb_ctx rpc; - - /** - * RPC server context of thread. When a thread attaches itself to this - * process, its \ref rpc member is added to the list maintained in this - * variable. This allows the original thread to do rpc calls without - * messing up other threads' rpc status. - * - * I think, more testing required. - */ - struct tcb_ctx server; - - /** Notifcation state of thread. */ - enum tcb_notify notify_state; - /** Whether thread has gotten an IPI */ bool ipi; }; -- cgit v1.3