@@ -158,8 +158,12 @@ mod x86_64 {
158
158
159
159
/// Write CR0 flags.
160
160
///
161
- /// Preserves the value of reserved fields. Unsafe because it's possible to violate memory
162
- /// safety by e.g. disabling paging.
161
+ /// Preserves the value of reserved fields.
162
+ ///
163
+ /// ## Safety
164
+ ///
165
+ /// This function is unsafe because it's possible to violate memory
166
+ /// safety through it, e.g. by disabling paging.
163
167
#[ inline]
164
168
pub unsafe fn write ( flags : Cr0Flags ) {
165
169
let old_value = Self :: read_raw ( ) ;
@@ -171,8 +175,12 @@ mod x86_64 {
171
175
172
176
/// Write raw CR0 flags.
173
177
///
174
- /// Does _not_ preserve any values, including reserved fields. Unsafe because it's possible to violate memory
175
- /// safety by e.g. disabling paging.
178
+ /// Does _not_ preserve any values, including reserved fields.
179
+ ///
180
+ /// ## Safety
181
+ ///
182
+ /// This function is unsafe because it's possible to violate memory
183
+ /// safety through it, e.g. by disabling paging.
176
184
#[ inline]
177
185
pub unsafe fn write_raw ( value : u64 ) {
178
186
#[ cfg( feature = "inline_asm" ) ]
@@ -184,8 +192,12 @@ mod x86_64 {
184
192
185
193
/// Updates CR0 flags.
186
194
///
187
- /// Preserves the value of reserved fields. Unsafe because it's possible to violate memory
188
- /// safety by e.g. disabling paging.
195
+ /// Preserves the value of reserved fields.
196
+ ///
197
+ /// ## Safety
198
+ ///
199
+ /// This function is unsafe because it's possible to violate memory
200
+ /// safety through it, e.g. by disabling paging.
189
201
#[ inline]
190
202
pub unsafe fn update < F > ( f : F )
191
203
where
@@ -283,8 +295,13 @@ mod x86_64 {
283
295
284
296
/// Write CR4 flags.
285
297
///
286
- /// Preserves the value of reserved fields. Unsafe because it's possible to violate memory
287
- /// safety by e.g. physical address extension.
298
+ /// Preserves the value of reserved fields.
299
+ ///
300
+ /// ## Safety
301
+ ///
302
+ /// This function is unsafe because it's possible to violate memory
303
+ /// safety through it, e.g. by overwriting the physical address extension
304
+ /// flag.
288
305
#[ inline]
289
306
pub unsafe fn write ( flags : Cr4Flags ) {
290
307
let old_value = Self :: read_raw ( ) ;
@@ -296,8 +313,13 @@ mod x86_64 {
296
313
297
314
/// Write raw CR4 flags.
298
315
///
299
- /// Does _not_ preserve any values, including reserved fields. Unsafe because it's possible to violate memory
300
- /// safety by e.g. physical address extension.
316
+ /// Does _not_ preserve any values, including reserved fields.
317
+ ///
318
+ /// ## Safety
319
+ ///
320
+ /// This function is unsafe because it's possible to violate memory
321
+ /// safety through it, e.g. by overwriting the physical address extension
322
+ /// flag.
301
323
#[ inline]
302
324
pub unsafe fn write_raw ( value : u64 ) {
303
325
#[ cfg( feature = "inline_asm" ) ]
@@ -309,8 +331,12 @@ mod x86_64 {
309
331
310
332
/// Updates CR4 flags.
311
333
///
312
- /// Preserves the value of reserved fields. Unsafe because it's possible to violate memory
313
- /// safety by e.g. physical address extension.
334
+ /// Preserves the value of reserved fields.
335
+ /// ## Safety
336
+ ///
337
+ /// This function is unsafe because it's possible to violate memory
338
+ /// safety through it, e.g. by overwriting the physical address extension
339
+ /// flag.
314
340
#[ inline]
315
341
pub unsafe fn update < F > ( f : F )
316
342
where
0 commit comments