Make frame allocator smaller. Fix serial stupid bug.

master
WangRunji 6 years ago
parent 3cf118ba67
commit ff8930a36c

@ -112,6 +112,7 @@ build/x86_64/os.iso: $(kernel) $(grub_cfg)
build/riscv32/os.iso: kernel build/riscv32/os.iso: kernel
@cp $(rust_lib) $@ @cp $(rust_lib) $@
@cp $(rust_lib) $(kernel)
$(kernel): kernel $(assembly_object_files) $(linker_script) $(kernel): kernel $(assembly_object_files) $(linker_script)
@$(ld) -n --gc-sections -T $(linker_script) -o $(kernel) \ @$(ld) -n --gc-sections -T $(linker_script) -o $(kernel) \

@ -41,5 +41,5 @@ pub fn putfmt(fmt: Arguments) {
const DATA: *mut u8 = 0x10000000 as *mut u8; const DATA: *mut u8 = 0x10000000 as *mut u8;
const STATUS: *const u8 = 0x10000005 as *const u8; const STATUS: *const u8 = 0x10000005 as *const u8;
const CAN_READ: u8 = 1 << 1; const CAN_READ: u8 = 1 << 0;
const CAN_WRITE: u8 = 1 << 5; const CAN_WRITE: u8 = 1 << 5;

@ -27,7 +27,7 @@ pub fn init() {
pub fn set_next() { pub fn set_next() {
// 100Hz @ QEMU // 100Hz @ QEMU
let timebase = 100000; let timebase = 250000;
set_timer(get_cycle() + timebase); set_timer(get_cycle() + timebase);
} }

@ -1,5 +1,5 @@
pub use arch::paging::*; pub use arch::paging::*;
use bit_allocator::{BitAlloc, BitAlloc64K}; use bit_allocator::{BitAlloc, BitAlloc4K};
use consts::MEMORY_OFFSET; use consts::MEMORY_OFFSET;
use spin::{Mutex, MutexGuard}; use spin::{Mutex, MutexGuard};
use super::HEAP_ALLOCATOR; use super::HEAP_ALLOCATOR;
@ -10,7 +10,7 @@ pub use ucore_memory::memory_set::{MemoryArea, MemoryAttr, MemorySet as MemorySe
pub type MemorySet = MemorySet_<InactivePageTable0>; pub type MemorySet = MemorySet_<InactivePageTable0>;
lazy_static! { lazy_static! {
pub static ref FRAME_ALLOCATOR: Mutex<BitAlloc64K> = Mutex::new(BitAlloc64K::default()); pub static ref FRAME_ALLOCATOR: Mutex<BitAlloc4K> = Mutex::new(BitAlloc4K::default());
} }
pub fn alloc_frame() -> Option<usize> { pub fn alloc_frame() -> Option<usize> {

@ -24,6 +24,7 @@ pub fn init() {
processor processor
}) })
); );
info!("process init end");
} }
pub static PROCESSOR: Once<SpinNoIrqLock<Processor>> = Once::new(); pub static PROCESSOR: Once<SpinNoIrqLock<Processor>> = Once::new();

Loading…
Cancel
Save