@@ -93,9 +93,12 @@ impl Mstatus {
93
93
self . bits & ( 1 << 1 ) != 0
94
94
}
95
95
96
- /// Set Supervisor Interrupt Enable
96
+ /// Update Supervisor Interrupt Enable
97
+ ///
98
+ /// Note this updates the [`Mstatus`] value, but does not affect the
99
+ /// mstatus CSR itself.
97
100
#[ inline]
98
- pub fn set_sie ( & self , sie : bool ) -> Self {
101
+ pub fn update_sie ( & self , sie : bool ) -> Self {
99
102
self . bf_insert ( 1 , 1 , sie as usize )
100
103
}
101
104
@@ -105,9 +108,12 @@ impl Mstatus {
105
108
self . bits & ( 1 << 3 ) != 0
106
109
}
107
110
108
- /// Set Machine Interrupt Enable
111
+ /// Update Machine Interrupt Enable
112
+ ///
113
+ /// Note this updates the [`Mstatus`] value, but does not affect the
114
+ /// mstatus CSR itself.
109
115
#[ inline]
110
- pub fn set_mie ( & self , mie : bool ) -> Self {
116
+ pub fn update_mie ( & self , mie : bool ) -> Self {
111
117
self . bf_insert ( 3 , 1 , mie as usize )
112
118
}
113
119
@@ -117,9 +123,12 @@ impl Mstatus {
117
123
self . bits & ( 1 << 5 ) != 0
118
124
}
119
125
120
- /// Supervisor Previous Interrupt Enable
126
+ /// Updateervisor Previous Interrupt Enable
127
+ ///
128
+ /// Note this updates the [`Mstatus`] value, but does not affect the
129
+ /// mstatus CSR itself.
121
130
#[ inline]
122
- pub fn set_spie ( & self , spie : bool ) -> Self {
131
+ pub fn update_spie ( & self , spie : bool ) -> Self {
123
132
self . bf_insert ( 5 , 1 , spie as usize )
124
133
}
125
134
@@ -129,9 +138,12 @@ impl Mstatus {
129
138
Endianness :: from ( self . bits & ( 1 << 6 ) != 0 )
130
139
}
131
140
132
- /// Set U-mode non-instruction-fetch memory endianness
141
+ /// Update U-mode non-instruction-fetch memory endianness
142
+ ///
143
+ /// Note this updates the [`Mstatus`] value, but does not affect the
144
+ /// mstatus CSR itself.
133
145
#[ inline]
134
- pub fn set_ube ( & self , endianness : Endianness ) -> Self {
146
+ pub fn update_ube ( & self , endianness : Endianness ) -> Self {
135
147
self . bf_insert ( 6 , 1 , endianness as usize )
136
148
}
137
149
@@ -141,9 +153,12 @@ impl Mstatus {
141
153
self . bits & ( 1 << 7 ) != 0
142
154
}
143
155
144
- /// Set Machine Previous Interrupt Enable
156
+ /// Update Machine Previous Interrupt Enable
157
+ ///
158
+ /// Note this updates the [`Mstatus`] value, but does not affect the
159
+ /// mstatus CSR itself.
145
160
#[ inline]
146
- pub fn set_mpie ( & self , mpie : bool ) -> Self {
161
+ pub fn update_mpie ( & self , mpie : bool ) -> Self {
147
162
self . bf_insert ( 7 , 1 , mpie as usize )
148
163
}
149
164
@@ -156,9 +171,12 @@ impl Mstatus {
156
171
}
157
172
}
158
173
159
- /// Set Supervisor Previous Privilege Mode
174
+ /// Update Supervisor Previous Privilege Mode
175
+ ///
176
+ /// Note this updates the [`Mstatus`] value, but does not affect the
177
+ /// mstatus CSR itself.
160
178
#[ inline]
161
- pub fn set_spp ( & self , spp : SPP ) -> Self {
179
+ pub fn update_spp ( & self , spp : SPP ) -> Self {
162
180
self . bf_insert ( 8 , 1 , spp as usize )
163
181
}
164
182
@@ -174,9 +192,12 @@ impl Mstatus {
174
192
}
175
193
}
176
194
177
- /// Set Machine Previous Privilege Mode
195
+ /// Update Machine Previous Privilege Mode
196
+ ///
197
+ /// Note this updates the [`Mstatus`] value, but does not affect the
198
+ /// mstatus CSR itself.
178
199
#[ inline]
179
- pub fn set_mpp ( & self , mpp : MPP ) -> Self {
200
+ pub fn update_mpp ( & self , mpp : MPP ) -> Self {
180
201
self . bf_insert ( 11 , 2 , mpp as usize )
181
202
}
182
203
@@ -196,9 +217,12 @@ impl Mstatus {
196
217
}
197
218
}
198
219
199
- /// Set Floating-point extension state
220
+ /// Update Floating-point extension state
221
+ ///
222
+ /// Note this updates the [`Mstatus`] value, but does not affect the
223
+ /// mstatus CSR itself.
200
224
#[ inline]
201
- pub fn set_fs ( & self , fs : FS ) -> Self {
225
+ pub fn update_fs ( & self , fs : FS ) -> Self {
202
226
self . bf_insert ( 13 , 2 , fs as usize )
203
227
}
204
228
@@ -217,9 +241,12 @@ impl Mstatus {
217
241
}
218
242
}
219
243
220
- /// Set Additional extension state
244
+ /// Update Additional extension state
245
+ ///
246
+ /// Note this updates the [`Mstatus`] value, but does not affect the
247
+ /// mstatus CSR itself.
221
248
#[ inline]
222
- pub fn set_xs ( & self , xs : XS ) -> Self {
249
+ pub fn update_xs ( & self , xs : XS ) -> Self {
223
250
self . bf_insert ( 15 , 2 , xs as usize )
224
251
}
225
252
@@ -229,9 +256,12 @@ impl Mstatus {
229
256
self . bits & ( 1 << 17 ) != 0
230
257
}
231
258
232
- /// Set Modify Memory PRiVilege
259
+ /// Update Modify Memory PRiVilege
260
+ ///
261
+ /// Note this updates the [`Mstatus`] value, but does not affect the
262
+ /// mstatus CSR itself.
233
263
#[ inline]
234
- pub fn set_mprv ( & self , mprv : bool ) -> Self {
264
+ pub fn update_mprv ( & self , mprv : bool ) -> Self {
235
265
self . bf_insert ( 17 , 1 , mprv as usize )
236
266
}
237
267
@@ -241,9 +271,12 @@ impl Mstatus {
241
271
self . bits & ( 1 << 18 ) != 0
242
272
}
243
273
244
- /// Set Permit Supervisor User Memory access
274
+ /// Update Permit Supervisor User Memory access
275
+ ///
276
+ /// Note this updates the [`Mstatus`] value, but does not affect the
277
+ /// mstatus CSR itself.
245
278
#[ inline]
246
- pub fn set_sum ( & self , sum : bool ) -> Self {
279
+ pub fn update_sum ( & self , sum : bool ) -> Self {
247
280
self . bf_insert ( 18 , 1 , sum as usize )
248
281
}
249
282
@@ -253,9 +286,12 @@ impl Mstatus {
253
286
self . bits & ( 1 << 19 ) != 0
254
287
}
255
288
256
- /// Set Make eXecutable Readable
289
+ /// Update Make eXecutable Readable
290
+ ///
291
+ /// Note this updates the [`Mstatus`] value, but does not affect the
292
+ /// mstatus CSR itself.
257
293
#[ inline]
258
- pub fn set_mxr ( & self , mxr : bool ) -> Self {
294
+ pub fn update_mxr ( & self , mxr : bool ) -> Self {
259
295
self . bf_insert ( 19 , 1 , mxr as usize )
260
296
}
261
297
@@ -270,9 +306,12 @@ impl Mstatus {
270
306
self . bits & ( 1 << 20 ) != 0
271
307
}
272
308
273
- /// Set Trap Virtual Memory
309
+ /// Update Trap Virtual Memory
310
+ ///
311
+ /// Note this updates the [`Mstatus`] value, but does not affect the
312
+ /// mstatus CSR itself.
274
313
#[ inline]
275
- pub fn set_tvm ( & self , tvm : bool ) -> Self {
314
+ pub fn update_tvm ( & self , tvm : bool ) -> Self {
276
315
self . bf_insert ( 20 , 1 , tvm as usize )
277
316
}
278
317
@@ -290,9 +329,12 @@ impl Mstatus {
290
329
self . bits & ( 1 << 21 ) != 0
291
330
}
292
331
293
- /// Set Timeout Wait
332
+ /// Update Timeout Wait
333
+ ///
334
+ /// Note this updates the [`Mstatus`] value, but does not affect the
335
+ /// mstatus CSR itself.
294
336
#[ inline]
295
- pub fn set_tw ( & self , tw : bool ) -> Self {
337
+ pub fn update_tw ( & self , tw : bool ) -> Self {
296
338
self . bf_insert ( 21 , 1 , tw as usize )
297
339
}
298
340
@@ -307,9 +349,12 @@ impl Mstatus {
307
349
self . bits & ( 1 << 22 ) != 0
308
350
}
309
351
310
- /// Set Trap SRET
352
+ /// Update Trap SRET
353
+ ///
354
+ /// Note this updates the [`Mstatus`] value, but does not affect the
355
+ /// mstatus CSR itself.
311
356
#[ inline]
312
- pub fn set_tsr ( & self , tsr : bool ) -> Self {
357
+ pub fn update_tsr ( & self , tsr : bool ) -> Self {
313
358
self . bf_insert ( 22 , 1 , tsr as usize )
314
359
}
315
360
@@ -326,9 +371,12 @@ impl Mstatus {
326
371
}
327
372
}
328
373
329
- /// Set Effective xlen in U-mode (i.e., `UXLEN`).
374
+ /// Update Effective xlen in U-mode (i.e., `UXLEN`).
375
+ ///
376
+ /// Note this updates the [`Mstatus`] value, but does not affect the
377
+ /// mstatus CSR itself.
330
378
#[ inline]
331
- pub fn set_uxl ( & self , uxl : XLEN ) -> Self {
379
+ pub fn update_uxl ( & self , uxl : XLEN ) -> Self {
332
380
#[ cfg( riscv32) ]
333
381
{
334
382
* self
@@ -350,9 +398,12 @@ impl Mstatus {
350
398
}
351
399
}
352
400
353
- /// Set Effective xlen in S-mode (i.e., `SXLEN`).
401
+ /// Update Effective xlen in S-mode (i.e., `SXLEN`).
402
+ ///
403
+ /// Note this updates the [`Mstatus`] value, but does not affect the
404
+ /// mstatus CSR itself.
354
405
#[ inline]
355
- pub fn set_sxl ( & self , sxl : XLEN ) -> Self {
406
+ pub fn update_sxl ( & self , sxl : XLEN ) -> Self {
356
407
#[ cfg( riscv32) ]
357
408
{
358
409
* self
@@ -373,9 +424,12 @@ impl Mstatus {
373
424
}
374
425
}
375
426
376
- /// Set S-mode non-instruction-fetch memory endianness
427
+ /// Update S-mode non-instruction-fetch memory endianness
428
+ ///
429
+ /// Note this updates the [`Mstatus`] value, but does not affect the
430
+ /// mstatus CSR itself.
377
431
#[ inline]
378
- pub fn set_sbe ( & self , endianness : Endianness ) -> Self {
432
+ pub fn update_sbe ( & self , endianness : Endianness ) -> Self {
379
433
#[ cfg( riscv32) ]
380
434
{
381
435
* self
@@ -395,9 +449,12 @@ impl Mstatus {
395
449
( ) => Endianness :: from ( self . bits & ( 1 << 37 ) != 0 ) ,
396
450
}
397
451
}
398
-
399
- /// Set M-mode non-instruction-fetch memory endianness
400
- pub fn set_mbe ( & self , endianness : Endianness ) -> Self {
452
+ /// Update M-mode non-instruction-fetch memory endianness
453
+ ///
454
+ /// Note this updates the [`Mstatus`] value, but does not affect the
455
+ /// mstatus CSR itself.
456
+ #[ inline]
457
+ pub fn update_mbe ( & self , endianness : Endianness ) -> Self {
401
458
#[ cfg( riscv32) ]
402
459
{
403
460
* self
@@ -412,9 +469,12 @@ impl Mstatus {
412
469
self . bits & ( 1 << ( usize:: BITS as usize - 1 ) ) != 0
413
470
}
414
471
415
- /// Set whether either the FS field or XS field signals the presence of some dirty state
472
+ /// Update whether either the FS field or XS field signals the presence of some dirty state
473
+ ///
474
+ /// Note this updates the [`Mstatus`] value, but does not affect the
475
+ /// mstatus CSR itself.
416
476
#[ inline]
417
- pub fn set_sd ( & self , sd : bool ) -> Self {
477
+ pub fn update_sd ( & self , sd : bool ) -> Self {
418
478
self . bf_insert ( usize:: BITS as usize - 1 , 1 , sd as usize )
419
479
}
420
480
}
0 commit comments