File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ authors = ["Yuekai Jia <equation618@gmail.com>"]
8
8
9
9
[dependencies ]
10
10
log = " 0.4"
11
- spin = " 0.9 "
11
+ spinlock = { path = " ../../crates/spinlock " }
12
12
memory_addr = { path = " ../../crates/memory_addr" }
13
13
allocator = { path = " ../../crates/allocator" }
14
14
axerror = { path = " ../axerror" }
Original file line number Diff line number Diff line change @@ -10,23 +10,23 @@ mod page;
10
10
use allocator:: { AllocResult , BaseAllocator , ByteAllocator , PageAllocator } ;
11
11
use allocator:: { BitmapPageAllocator , BuddyByteAllocator } ;
12
12
use core:: alloc:: { GlobalAlloc , Layout } ;
13
- use spin :: Mutex ;
13
+ use spinlock :: SpinNoIrq ;
14
14
15
15
const PAGE_SIZE : usize = 0x1000 ;
16
16
const MIN_HEAP_SIZE : usize = 0x4000 ; // 16 K
17
17
18
18
pub use page:: GlobalPage ;
19
19
20
20
pub struct GlobalAllocator {
21
- balloc : Mutex < BuddyByteAllocator > , // TODO: use IRQ-disabled lock
22
- palloc : Mutex < BitmapPageAllocator < PAGE_SIZE > > ,
21
+ balloc : SpinNoIrq < BuddyByteAllocator > , // TODO: use IRQ-disabled lock
22
+ palloc : SpinNoIrq < BitmapPageAllocator < PAGE_SIZE > > ,
23
23
}
24
24
25
25
impl GlobalAllocator {
26
26
pub const fn new ( ) -> Self {
27
27
Self {
28
- balloc : Mutex :: new ( BuddyByteAllocator :: new ( ) ) ,
29
- palloc : Mutex :: new ( BitmapPageAllocator :: new ( ) ) ,
28
+ balloc : SpinNoIrq :: new ( BuddyByteAllocator :: new ( ) ) ,
29
+ palloc : SpinNoIrq :: new ( BitmapPageAllocator :: new ( ) ) ,
30
30
}
31
31
}
32
32
You can’t perform that action at this time.
0 commit comments