Skip to content

Commit

Permalink
Fix TLS layout on x86_64
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Spinale <[email protected]>
  • Loading branch information
nspin committed Mar 16, 2024
1 parent 479ccb3 commit 15fb542
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/sel4-initialize-tls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,17 @@ impl TlsReservationLayout {
}
} else if cfg!(target_arch = "x86_64") {
let tcb_size = 2 * mem::size_of::<usize>(); // could probably get away with just 1x word size
let thread_pointer_offset = segment_layout
.size()
.next_multiple_of(segment_layout.align());
Self {
footprint: Layout::from_size_align(
segment_layout.size() + tcb_size,
thread_pointer_offset + tcb_size,
segment_layout.align(),
)
.unwrap(),
segment_offset: 0,
thread_pointer_offset: segment_layout.size(),
thread_pointer_offset,
}
} else {
unreachable!();
Expand Down

0 comments on commit 15fb542

Please sign in to comment.