x86: define dynamic thread object alignment
x86 and x86_64 require certain alignment in the k_thread struct since the buffer to save/restore FPU/SSE registers requires strict alignment. Fixes #29589 Fixes #29629 Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
fe477ea6d3
commit
7a5f9e81de
2 changed files with 24 additions and 0 deletions
|
@ -445,6 +445,25 @@ extern struct task_state_segment _main_tss;
|
|||
CODE_UNREACHABLE; \
|
||||
} while (false)
|
||||
|
||||
/*
|
||||
* Dynamic thread object memory alignment.
|
||||
*
|
||||
* If support for SSEx extensions is enabled a 16 byte boundary is required,
|
||||
* since the 'fxsave' and 'fxrstor' instructions require this. In all other
|
||||
* cases a 4 byte boundary is sufficient.
|
||||
*/
|
||||
#if defined(CONFIG_EAGER_FPU_SHARING) || defined(CONFIG_LAZY_FPU_SHARING)
|
||||
#ifdef CONFIG_SSE
|
||||
#define ARCH_DYMANIC_OBJ_K_THREAD_ALIGNMENT 16
|
||||
#else
|
||||
#define ARCH_DYMANIC_OBJ_K_THREAD_ALIGNMENT (sizeof(void *))
|
||||
#endif
|
||||
#else
|
||||
/* No special alignment requirements, simply align on pointer size. */
|
||||
#define ARCH_DYMANIC_OBJ_K_THREAD_ALIGNMENT (sizeof(void *))
|
||||
#endif /* CONFIG_*_FP_SHARING */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -133,4 +133,9 @@ struct x86_ssf {
|
|||
(void (*)(const void *))isr_p, \
|
||||
isr_param_p, flags_p)
|
||||
|
||||
/*
|
||||
* Thread object needs to be 16-byte aligned.
|
||||
*/
|
||||
#define ARCH_DYMANIC_OBJ_K_THREAD_ALIGNMENT 16
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_ARCH_X86_INTEL64_ARCH_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue