mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-30 12:03:56 +00:00
Make ostd::trap::irq
public
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
751e0b2ebf
commit
b96c8f9ed2
@ -7,7 +7,7 @@ use core::{alloc::Layout, cell::RefCell};
|
||||
use ostd::{
|
||||
cpu_local,
|
||||
mm::{Paddr, PAGE_SIZE},
|
||||
trap::DisabledLocalIrqGuard,
|
||||
trap::irq::DisabledLocalIrqGuard,
|
||||
};
|
||||
|
||||
cpu_local! {
|
||||
|
@ -64,7 +64,7 @@ pub struct FrameAllocator;
|
||||
|
||||
impl GlobalFrameAllocator for FrameAllocator {
|
||||
fn alloc(&self, layout: Layout) -> Option<Paddr> {
|
||||
let guard = trap::disable_local();
|
||||
let guard = trap::irq::disable_local();
|
||||
let res = cache::alloc(&guard, layout);
|
||||
if res.is_some() {
|
||||
TOTAL_FREE_SIZE.sub(guard.current_cpu(), layout.size());
|
||||
@ -73,13 +73,13 @@ impl GlobalFrameAllocator for FrameAllocator {
|
||||
}
|
||||
|
||||
fn dealloc(&self, addr: Paddr, size: usize) {
|
||||
let guard = trap::disable_local();
|
||||
let guard = trap::irq::disable_local();
|
||||
TOTAL_FREE_SIZE.add(guard.current_cpu(), size);
|
||||
cache::dealloc(&guard, addr, size);
|
||||
}
|
||||
|
||||
fn add_free_memory(&self, addr: Paddr, size: usize) {
|
||||
let guard = trap::disable_local();
|
||||
let guard = trap::irq::disable_local();
|
||||
TOTAL_FREE_SIZE.add(guard.current_cpu(), size);
|
||||
pools::add_free_memory(&guard, addr, size);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ use ostd::{
|
||||
cpu_local,
|
||||
mm::Paddr,
|
||||
sync::{LocalIrqDisabled, SpinLock, SpinLockGuard},
|
||||
trap::DisabledLocalIrqGuard,
|
||||
trap::irq::DisabledLocalIrqGuard,
|
||||
};
|
||||
|
||||
use crate::chunk::{greater_order_of, lesser_order_of, size_of_order, split_to_chunks, BuddyOrder};
|
||||
|
@ -98,7 +98,7 @@ mod test {
|
||||
pub static FREE_SIZE_COUNTER: usize;
|
||||
}
|
||||
|
||||
let guard = trap::disable_local();
|
||||
let guard = trap::irq::disable_local();
|
||||
let cur_cpu = guard.current_cpu();
|
||||
FREE_SIZE_COUNTER.add(cur_cpu, 10);
|
||||
assert_eq!(FREE_SIZE_COUNTER.get(), 10);
|
||||
|
Reference in New Issue
Block a user