From: kosmirror <kos...@us...> - 2025-07-12 18:37:34
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 908fbacbb4a32e51d872e624e9dcc556477477bb (commit) from c8b4cd2cd1809af47593b3982bd10d0c5e0eaadf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 908fbacbb4a32e51d872e624e9dcc556477477bb Author: darc <da...@pr...> Date: Fri May 30 17:49:57 2025 -0500 Use THD_STACK_ALIGNMENT to adjust arch's stack alignment requirements ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/include/arch/arch.h | 5 +++++ kernel/thread/thread.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/kernel/arch/dreamcast/include/arch/arch.h b/kernel/arch/dreamcast/include/arch/arch.h index f79915de..79a0fe83 100644 --- a/kernel/arch/dreamcast/include/arch/arch.h +++ b/kernel/arch/dreamcast/include/arch/arch.h @@ -79,6 +79,11 @@ extern char _etext; static const unsigned HZ __depr("Please use the new THD_SCHED_HZ macro.") = THD_SCHED_HZ; +#ifndef THD_STACK_ALIGNMENT +/** \brief Required alignment for stack. */ +#define THD_STACK_ALIGNMENT 8 +#endif + #ifndef THD_STACK_SIZE /** \brief Default thread stack size. */ #define THD_STACK_SIZE 32768 diff --git a/kernel/thread/thread.c b/kernel/thread/thread.c index b1faf558..8b56e708 100644 --- a/kernel/thread/thread.c +++ b/kernel/thread/thread.c @@ -45,8 +45,8 @@ also using their queue library verbatim (sys/queue.h). */ /* Builtin background thread data */ -static alignas(8) uint8_t thd_reaper_stack[512]; -static alignas(8) uint8_t thd_idle_stack[64]; +static alignas(THD_STACK_ALIGNMENT) uint8_t thd_reaper_stack[512]; +static alignas(THD_STACK_ALIGNMENT) uint8_t thd_idle_stack[64]; /*****************************************************************************/ /* Thread scheduler data */ @@ -404,7 +404,8 @@ kthread_t *thd_create_ex(const kthread_attr_t *restrict attr, /* Create a new thread stack */ if(!real_attr.stack_ptr) { - nt->stack = (uint32_t*)malloc(real_attr.stack_size); + nt->stack = (uint32_t*)aligned_alloc(THD_STACK_ALIGNMENT, + real_attr.stack_size); if(!nt->stack) { free(nt); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |