@@ -9,7 +9,7 @@ use crate::{
9
9
use core:: arch:: asm;
10
10
11
11
macro_rules! get_reg_impl {
12
- ( $name: literal, $asm_get : ident ) => {
12
+ ( $name: literal) => {
13
13
fn get_reg( ) -> SegmentSelector {
14
14
let segment: u16 ;
15
15
unsafe {
@@ -21,9 +21,9 @@ macro_rules! get_reg_impl {
21
21
}
22
22
23
23
macro_rules! segment_impl {
24
- ( $type: ty, $name: literal, $asm_get : ident , $asm_load : ident ) => {
24
+ ( $type: ty, $name: literal) => {
25
25
impl Segment for $type {
26
- get_reg_impl!( $name, $asm_get ) ;
26
+ get_reg_impl!( $name) ;
27
27
28
28
unsafe fn set_reg( sel: SegmentSelector ) {
29
29
unsafe {
@@ -35,7 +35,7 @@ macro_rules! segment_impl {
35
35
}
36
36
37
37
macro_rules! segment64_impl {
38
- ( $type: ty, $name: literal, $base: ty, $asm_rd : ident , $asm_wr : ident ) => {
38
+ ( $type: ty, $name: literal, $base: ty) => {
39
39
impl Segment64 for $type {
40
40
const BASE : Msr = <$base>:: MSR ;
41
41
fn read_base( ) -> VirtAddr {
@@ -56,7 +56,7 @@ macro_rules! segment64_impl {
56
56
}
57
57
58
58
impl Segment for CS {
59
- get_reg_impl ! ( "cs" , x86_64_asm_get_cs ) ;
59
+ get_reg_impl ! ( "cs" ) ;
60
60
61
61
/// Note this is special since we cannot directly move to [`CS`]; x86 requires the instruction
62
62
/// pointer and [`CS`] to be set at the same time. To do this, we push the new segment selector
@@ -82,13 +82,13 @@ impl Segment for CS {
82
82
}
83
83
}
84
84
85
- segment_impl ! ( SS , "ss" , x86_64_asm_get_ss , x86_64_asm_load_ss ) ;
86
- segment_impl ! ( DS , "ds" , x86_64_asm_get_ds , x86_64_asm_load_ds ) ;
87
- segment_impl ! ( ES , "es" , x86_64_asm_get_es , x86_64_asm_load_es ) ;
88
- segment_impl ! ( FS , "fs" , x86_64_asm_get_fs , x86_64_asm_load_fs ) ;
89
- segment64_impl ! ( FS , "fs" , FsBase , x86_64_asm_rdfsbase , x86_64_asm_wrfsbase ) ;
90
- segment_impl ! ( GS , "gs" , x86_64_asm_get_gs , x86_64_asm_load_gs ) ;
91
- segment64_impl ! ( GS , "gs" , GsBase , x86_64_asm_rdgsbase , x86_64_asm_wrgsbase ) ;
85
+ segment_impl ! ( SS , "ss" ) ;
86
+ segment_impl ! ( DS , "ds" ) ;
87
+ segment_impl ! ( ES , "es" ) ;
88
+ segment_impl ! ( FS , "fs" ) ;
89
+ segment64_impl ! ( FS , "fs" , FsBase ) ;
90
+ segment_impl ! ( GS , "gs" ) ;
91
+ segment64_impl ! ( GS , "gs" , GsBase ) ;
92
92
93
93
impl GS {
94
94
/// Swap `KernelGsBase` MSR and `GsBase` MSR.
0 commit comments