@@ -307,8 +307,13 @@ mod x86_64 {
307
307
///
308
308
/// If [`CR4.FSGSBASE`][Cr4Flags::FSGSBASE] is set, the more efficient
309
309
/// [`FS::write_base`] can be used instead.
310
+ ///
311
+ /// ## Safety
312
+ ///
313
+ /// The caller must ensure that this write operation has no unsafe side
314
+ /// effects, as the segment base address might be in use.
310
315
#[ inline]
311
- pub fn write ( address : VirtAddr ) {
316
+ pub unsafe fn write ( address : VirtAddr ) {
312
317
let mut msr = Self :: MSR ;
313
318
unsafe { msr. write ( address. as_u64 ( ) ) } ;
314
319
}
@@ -328,8 +333,13 @@ mod x86_64 {
328
333
///
329
334
/// If [`CR4.FSGSBASE`][Cr4Flags::FSGSBASE] is set, the more efficient
330
335
/// [`GS::write_base`] can be used instead.
336
+ ///
337
+ /// ## Safety
338
+ ///
339
+ /// The caller must ensure that this write operation has no unsafe side
340
+ /// effects, as the segment base address might be in use.
331
341
#[ inline]
332
- pub fn write ( address : VirtAddr ) {
342
+ pub unsafe fn write ( address : VirtAddr ) {
333
343
let mut msr = Self :: MSR ;
334
344
unsafe { msr. write ( address. as_u64 ( ) ) } ;
335
345
}
@@ -343,8 +353,12 @@ mod x86_64 {
343
353
}
344
354
345
355
/// Write a given virtual address to the KernelGsBase register.
356
+ ///
357
+ /// ## Safety
358
+ ///
359
+ /// The caller must ensure that a future call to [`GS::swap`] has no unsafe side effects.
346
360
#[ inline]
347
- pub fn write ( address : VirtAddr ) {
361
+ pub unsafe fn write ( address : VirtAddr ) {
348
362
let mut msr = Self :: MSR ;
349
363
unsafe { msr. write ( address. as_u64 ( ) ) } ;
350
364
}
0 commit comments