diff --git a/Makefile b/Makefile index 0a23bf8..1c0676d 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ all: $(KBUILD)/harddrive.bin clean: cargo clean cargo clean --manifest-path libstd/Cargo.toml + cargo clean --manifest-path drivers/ahcid/Cargo.toml cargo clean --manifest-path drivers/ps2d/Cargo.toml cargo clean --manifest-path drivers/pcid/Cargo.toml cargo clean --manifest-path drivers/vesad/Cargo.toml @@ -55,7 +56,7 @@ qemu: $(KBUILD)/harddrive.bin $(QEMU) $(QEMUFLAGS) -kernel $< else LD=ld - QEMUFLAGS+=-machine q35 -smp 4 + QEMUFLAGS+=-machine q35 -smp 4 -m 256 ifeq ($(kvm),yes) QEMUFLAGS+=-enable-kvm -cpu host endif @@ -168,6 +169,7 @@ coreutils: \ initfs/bin/realpath $(BUILD)/initfs.rs: \ + initfs/bin/ahcid \ initfs/bin/pcid \ initfs/bin/ps2d \ initfs/bin/vesad \ diff --git a/arch/x86_64/src/memory/area_frame_allocator.rs b/arch/x86_64/src/memory/area_frame_allocator.rs index 54088d2..6367d06 100644 --- a/arch/x86_64/src/memory/area_frame_allocator.rs +++ b/arch/x86_64/src/memory/area_frame_allocator.rs @@ -44,11 +44,13 @@ impl AreaFrameAllocator { impl FrameAllocator for AreaFrameAllocator { fn allocate_frames(&mut self, count: usize) -> Option { - if let Some(area) = self.current_area { + if count == 0 { + None + } else if let Some(area) = self.current_area { // "Clone" the frame to return it if it's free. Frame doesn't // implement Clone, but we can construct an identical frame. let start_frame = Frame{ number: self.next_free_frame.number }; - let end_frame = Frame { number: self.next_free_frame.number + count }; + let end_frame = Frame { number: self.next_free_frame.number + (count - 1) }; // the last frame of the current area let current_area_last_frame = { diff --git a/drivers/ahcid/src/ahci/mod.rs b/drivers/ahcid/src/ahci/mod.rs index cdf54ca..6cc266f 100644 --- a/drivers/ahcid/src/ahci/mod.rs +++ b/drivers/ahcid/src/ahci/mod.rs @@ -22,7 +22,6 @@ impl Ahci { println!("{}: {:?}", i, port_type); match port_type { HbaPortType::SATA => { - /* disk.port.init(); if let Some(size) = unsafe { disk.port.identify(i) } { disk.size = size; @@ -30,8 +29,6 @@ impl Ahci { } else { None } - */ - None } _ => None, }