@@ -10,6 +10,7 @@ use core::arch::asm;
10
10
11
11
macro_rules! get_reg_impl {
12
12
( $name: literal) => {
13
+ #[ inline]
13
14
fn get_reg( ) -> SegmentSelector {
14
15
let segment: u16 ;
15
16
unsafe {
@@ -25,6 +26,7 @@ macro_rules! segment_impl {
25
26
impl Segment for $type {
26
27
get_reg_impl!( $name) ;
27
28
29
+ #[ inline]
28
30
unsafe fn set_reg( sel: SegmentSelector ) {
29
31
unsafe {
30
32
asm!( concat!( "mov " , $name, ", {0:x}" ) , in( reg) sel. 0 , options( nostack, preserves_flags) ) ;
@@ -38,6 +40,7 @@ macro_rules! segment64_impl {
38
40
( $type: ty, $name: literal, $base: ty) => {
39
41
impl Segment64 for $type {
40
42
const BASE : Msr = <$base>:: MSR ;
43
+ #[ inline]
41
44
fn read_base( ) -> VirtAddr {
42
45
unsafe {
43
46
let val: u64 ;
@@ -46,6 +49,7 @@ macro_rules! segment64_impl {
46
49
}
47
50
}
48
51
52
+ #[ inline]
49
53
unsafe fn write_base( base: VirtAddr ) {
50
54
unsafe {
51
55
asm!( concat!( "wr" , $name, "base {}" ) , in( reg) base. as_u64( ) , options( nostack, preserves_flags) ) ;
@@ -66,6 +70,7 @@ impl Segment for CS {
66
70
/// Note we cannot use a "far call" (`lcall`) or "far jmp" (`ljmp`) to do this because then we
67
71
/// would only be able to jump to 32-bit instruction pointers. Only Intel implements support
68
72
/// for 64-bit far calls/jumps in long-mode, AMD does not.
73
+ #[ inline]
69
74
unsafe fn set_reg ( sel : SegmentSelector ) {
70
75
unsafe {
71
76
asm ! (
@@ -97,6 +102,7 @@ impl GS {
97
102
///
98
103
/// This function is unsafe because the caller must ensure that the
99
104
/// swap operation cannot lead to undefined behavior.
105
+ #[ inline]
100
106
pub unsafe fn swap ( ) {
101
107
unsafe {
102
108
asm ! ( "swapgs" , options( nostack, preserves_flags) ) ;
0 commit comments