Skip to content

Commit e088372

Browse files
committed
fix: update percpu dependency version and add static mutable reference allowances
1 parent 0f532c3 commit e088372

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ license = "Apache-2.0"
1212
[dependencies]
1313
axerrno = "0.1.0"
1414
memory_addr = "0.4"
15-
percpu = "0.2.0"
15+
percpu = "0.2.3-preview.1"
1616
axaddrspace = "0.1.4"
1717
axvisor_api = "0.1"

src/vcpu.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ static mut CURRENT_VCPU: Option<*mut u8> = None;
314314
///
315315
/// It's guaranteed that each time before a method of [`AxArchVCpu`] is called, the current VCpu is set to the corresponding [`AxVCpu`].
316316
/// So methods of [`AxArchVCpu`] can always get the [`AxVCpu`] containing itself by calling this method.
317+
#[allow(static_mut_refs)]
317318
pub fn get_current_vcpu<'a, A: AxArchVCpu>() -> Option<&'a AxVCpu<A>> {
318319
unsafe {
319320
CURRENT_VCPU
@@ -327,6 +328,7 @@ pub fn get_current_vcpu<'a, A: AxArchVCpu>() -> Option<&'a AxVCpu<A>> {
327328
/// Get a mutable reference to the current VCpu on the current physical CPU.
328329
///
329330
/// See [`get_current_vcpu`] for more details.
331+
#[allow(static_mut_refs)]
330332
pub fn get_current_vcpu_mut<'a, A: AxArchVCpu>() -> Option<&'a mut AxVCpu<A>> {
331333
unsafe {
332334
CURRENT_VCPU
@@ -342,6 +344,7 @@ pub fn get_current_vcpu_mut<'a, A: AxArchVCpu>() -> Option<&'a mut AxVCpu<A>> {
342344
/// # Safety
343345
/// This method is marked as unsafe because it may result in unexpected behavior if not used properly.
344346
/// Do not call this method unless you know what you are doing.
347+
#[allow(static_mut_refs)]
345348
pub unsafe fn set_current_vcpu<A: AxArchVCpu>(vcpu: &AxVCpu<A>) {
346349
unsafe {
347350
CURRENT_VCPU
@@ -354,7 +357,8 @@ pub unsafe fn set_current_vcpu<A: AxArchVCpu>(vcpu: &AxVCpu<A>) {
354357
///
355358
/// # Safety
356359
/// This method is marked as unsafe because it may result in unexpected behavior if not used properly.
357-
/// Do not call this method unless you know what you are doing.
360+
/// Do not call this method unless you know what you are doing.
361+
#[allow(static_mut_refs)]
358362
pub unsafe fn clear_current_vcpu<A: AxArchVCpu>() {
359363
unsafe {
360364
CURRENT_VCPU.current_ref_mut_raw().take();

0 commit comments

Comments
 (0)