Skip to content

Commit c35564e

Browse files
committed
feat(hal-x86_64): add SystemSegment::boxed_tss (#372)
Currently, TSS segments can only be constructed from statics. This makes it difficult to construct a TSS dynamically when bringing up an application processor. This commit adds a new `SystemSegment::boxed_tss` constructor, which allows TSS segments to be dynamically allocated, as well as stored in a static. This was factored out of PR #371.
1 parent 75ce046 commit c35564e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

hal-x86_64/src/segment.rs

+5
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,11 @@ impl SystemDescriptor {
513513
const BASE_HIGH: bits::Pack64 = bits::Pack64::least_significant(32);
514514
const BASE_HIGH_PAIR: Pair64 = Self::BASE_HIGH.pair_with(base::HIGH);
515515

516+
#[cfg(feature = "alloc")]
517+
pub fn boxed_tss(tss: alloc::boxed::Box<task::StateSegment>) -> Self {
518+
Self::tss(alloc::boxed::Box::leak(tss))
519+
}
520+
516521
pub fn tss(tss: &'static task::StateSegment) -> Self {
517522
let tss_addr = tss as *const _ as u64;
518523
tracing::trace!(tss_addr = fmt::hex(tss_addr), "making TSS descriptor...");

0 commit comments

Comments
 (0)