From eeac9e1436d961e0103f5125794e050758a91670 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Tue, 7 May 2024 00:11:55 -0400 Subject: kernel/amd64: tss: Ensure stacks are aligned When allocating a kernel stack, ensure it is aligned on a 16-byte boundary. Signed-off-by: Ian Moffett --- sys/arch/amd64/amd64/tss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arch/amd64/amd64/tss.c b/sys/arch/amd64/amd64/tss.c index c2ca6af..c9fc3bb 100644 --- a/sys/arch/amd64/amd64/tss.c +++ b/sys/arch/amd64/amd64/tss.c @@ -57,7 +57,7 @@ alloc_resources(struct cpu_info *cpu) panic("Failed to alloc %d bytes for TSS\n", sizeof(*tss)); memset(tss, 0, sizeof(*tss)); - rsp0_base = (uintptr_t)dynalloc(STACK_SIZE); + rsp0_base = (uintptr_t)dynalloc_memalign(STACK_SIZE, 16); if (rsp0_base == 0) panic("Could not allocate rsp0 base\n"); @@ -131,7 +131,7 @@ tss_update_ist(struct cpu_info *ci, union tss_stack stack, uint8_t istno) int tss_alloc_stack(union tss_stack *entry_out, size_t size) { - uintptr_t base = (uintptr_t)dynalloc(size); + uintptr_t base = (uintptr_t)dynalloc_memalign(size, 16); if (base == 0) { return -EXIT_FAILURE; -- cgit v1.2.3