hermit/arch/x86_64/
mod.rs1pub mod kernel;
2pub mod mm;
3
4#[cfg(feature = "common-os")]
5use x86_64::registers::segmentation::SegmentSelector;
6
7use crate::arch::mm::paging::ExceptionStackFrame;
8
9#[cfg(feature = "common-os")]
11#[inline(always)]
12pub(crate) fn swapgs(stack_frame: &ExceptionStackFrame) {
13 use core::arch::asm;
14 if stack_frame.code_segment != SegmentSelector(8) {
15 unsafe {
16 asm!("swapgs", options(nomem, nostack, preserves_flags));
17 }
18 }
19}
20
21#[cfg(not(feature = "common-os"))]
22#[inline(always)]
23pub(crate) fn swapgs(_stack_frame: &ExceptionStackFrame) {}