From e3e8a3e112fc0cc985f7fac3da9767dc6b20dd83 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Wed, 19 Feb 2020 10:27:26 +0100 Subject: [PATCH] Align the double fault stack through a new wrapper type --- src/gdt.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gdt.rs b/src/gdt.rs index de61a7d8d..a3b2eeca8 100644 --- a/src/gdt.rs +++ b/src/gdt.rs @@ -10,7 +10,11 @@ lazy_static! { let mut tss = TaskStateSegment::new(); tss.interrupt_stack_table[DOUBLE_FAULT_IST_INDEX as usize] = { const STACK_SIZE: usize = 4096; - static mut STACK: [u8; STACK_SIZE] = [0; STACK_SIZE]; + + #[repr(align(16))] + struct Stack([u8; STACK_SIZE]); + + static mut STACK: Stack = Stack([0; STACK_SIZE]); let stack_start = VirtAddr::from_ptr(unsafe { &STACK }); let stack_end = stack_start + STACK_SIZE;