Skip to content

Commit de2f043

Browse files
committed
perf(x86_64): don't initialize boot stack
1 parent 0473af1 commit de2f043

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/arch/x86_64/stack.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
use core::cell::UnsafeCell;
2-
use core::mem;
2+
use core::mem::{self, MaybeUninit};
33

44
#[repr(C, align(0x1000))]
5-
pub struct Stack(UnsafeCell<[u8; 0x1000]>);
5+
pub struct Stack(UnsafeCell<[MaybeUninit<u8>; 0x1000]>);
66

77
unsafe impl Sync for Stack {}
88

99
impl Stack {
1010
const fn new() -> Self {
11-
let fill = 0xcd;
11+
let fill = if cfg!(debug_assertions) {
12+
MaybeUninit::new(0xcd)
13+
} else {
14+
MaybeUninit::uninit()
15+
};
1216
Self(UnsafeCell::new([fill; _]))
1317
}
1418

0 commit comments

Comments
 (0)