@@ -77,66 +77,78 @@ typedef unsigned int addr_t;
77
77
78
78
static inline u8 rdfs8 (addr_t addr )
79
79
{
80
+ u8 * ptr = (u8 * )absolute_pointer (addr );
80
81
u8 v ;
81
- asm volatile ("movb %%fs:%1,%0" : "=q" (v ) : "m" (* ( u8 * ) addr ));
82
+ asm volatile ("movb %%fs:%1,%0" : "=q" (v ) : "m" (* ptr ));
82
83
return v ;
83
84
}
84
85
static inline u16 rdfs16 (addr_t addr )
85
86
{
87
+ u16 * ptr = (u16 * )absolute_pointer (addr );
86
88
u16 v ;
87
- asm volatile ("movw %%fs:%1,%0" : "=r" (v ) : "m" (* ( u16 * ) addr ));
89
+ asm volatile ("movw %%fs:%1,%0" : "=r" (v ) : "m" (* ptr ));
88
90
return v ;
89
91
}
90
92
static inline u32 rdfs32 (addr_t addr )
91
93
{
94
+ u32 * ptr = (u32 * )absolute_pointer (addr );
92
95
u32 v ;
93
- asm volatile ("movl %%fs:%1,%0" : "=r" (v ) : "m" (* ( u32 * ) addr ));
96
+ asm volatile ("movl %%fs:%1,%0" : "=r" (v ) : "m" (* ptr ));
94
97
return v ;
95
98
}
96
99
97
100
static inline void wrfs8 (u8 v , addr_t addr )
98
101
{
99
- asm volatile ("movb %1,%%fs:%0" : "+m" (* (u8 * )addr ) : "qi" (v ));
102
+ u8 * ptr = (u8 * )absolute_pointer (addr );
103
+ asm volatile ("movb %1,%%fs:%0" : "+m" (* ptr ) : "qi" (v ));
100
104
}
101
105
static inline void wrfs16 (u16 v , addr_t addr )
102
106
{
103
- asm volatile ("movw %1,%%fs:%0" : "+m" (* (u16 * )addr ) : "ri" (v ));
107
+ u16 * ptr = (u16 * )absolute_pointer (addr );
108
+ asm volatile ("movw %1,%%fs:%0" : "+m" (* ptr ) : "ri" (v ));
104
109
}
105
110
static inline void wrfs32 (u32 v , addr_t addr )
106
111
{
107
- asm volatile ("movl %1,%%fs:%0" : "+m" (* (u32 * )addr ) : "ri" (v ));
112
+ u32 * ptr = (u32 * )absolute_pointer (addr );
113
+ asm volatile ("movl %1,%%fs:%0" : "+m" (* ptr ) : "ri" (v ));
108
114
}
109
115
110
116
static inline u8 rdgs8 (addr_t addr )
111
117
{
118
+ u8 * ptr = (u8 * )absolute_pointer (addr );
112
119
u8 v ;
113
- asm volatile ("movb %%gs:%1,%0" : "=q" (v ) : "m" (* ( u8 * ) addr ));
120
+ asm volatile ("movb %%gs:%1,%0" : "=q" (v ) : "m" (* ptr ));
114
121
return v ;
115
122
}
116
123
static inline u16 rdgs16 (addr_t addr )
117
124
{
125
+ u16 * ptr = (u16 * )absolute_pointer (addr );
118
126
u16 v ;
119
- asm volatile ("movw %%gs:%1,%0" : "=r" (v ) : "m" (* ( u16 * ) addr ));
127
+ asm volatile ("movw %%gs:%1,%0" : "=r" (v ) : "m" (* ptr ));
120
128
return v ;
121
129
}
122
130
static inline u32 rdgs32 (addr_t addr )
123
131
{
132
+ u32 * ptr = (u32 * )absolute_pointer (addr );
124
133
u32 v ;
125
- asm volatile ("movl %%gs:%1,%0" : "=r" (v ) : "m" (* ( u32 * ) addr ));
134
+ asm volatile ("movl %%gs:%1,%0" : "=r" (v ) : "m" (* ptr ));
126
135
return v ;
127
136
}
128
137
129
138
static inline void wrgs8 (u8 v , addr_t addr )
130
139
{
131
- asm volatile ("movb %1,%%gs:%0" : "+m" (* (u8 * )addr ) : "qi" (v ));
140
+ u8 * ptr = (u8 * )absolute_pointer (addr );
141
+ asm volatile ("movb %1,%%gs:%0" : "+m" (* ptr ) : "qi" (v ));
132
142
}
133
143
static inline void wrgs16 (u16 v , addr_t addr )
134
144
{
135
- asm volatile ("movw %1,%%gs:%0" : "+m" (* (u16 * )addr ) : "ri" (v ));
145
+ u16 * ptr = (u16 * )absolute_pointer (addr );
146
+ asm volatile ("movw %1,%%gs:%0" : "+m" (* ptr ) : "ri" (v ));
136
147
}
137
148
static inline void wrgs32 (u32 v , addr_t addr )
138
149
{
139
- asm volatile ("movl %1,%%gs:%0" : "+m" (* (u32 * )addr ) : "ri" (v ));
150
+ u32 * ptr = (u32 * )absolute_pointer (addr );
151
+ asm volatile ("movl %1,%%gs:%0" : "+m" (* ptr ) : "ri" (v ));
140
152
}
141
153
142
154
/* Note: these only return true/false, not a signed return value! */
0 commit comments