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