aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-05-07 00:11:55 -0400
committerIan Moffett <ian@osmora.org>2024-05-07 00:11:55 -0400
commiteeac9e1436d961e0103f5125794e050758a91670 (patch)
tree98e8cefde0a0189d68127c8b8ff76f83e588f112
parent198c05c4b8411222502a20fb2ea9d9a88837d11a (diff)
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 <ian@osmora.org>
-rw-r--r--sys/arch/amd64/amd64/tss.c4
1 files 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;