Fix allocate_frames
This commit is contained in:
parent
dad81d3c46
commit
d72609898a
4
Makefile
4
Makefile
|
@ -24,6 +24,7 @@ all: $(KBUILD)/harddrive.bin
|
||||||
clean:
|
clean:
|
||||||
cargo clean
|
cargo clean
|
||||||
cargo clean --manifest-path libstd/Cargo.toml
|
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/ps2d/Cargo.toml
|
||||||
cargo clean --manifest-path drivers/pcid/Cargo.toml
|
cargo clean --manifest-path drivers/pcid/Cargo.toml
|
||||||
cargo clean --manifest-path drivers/vesad/Cargo.toml
|
cargo clean --manifest-path drivers/vesad/Cargo.toml
|
||||||
|
@ -55,7 +56,7 @@ qemu: $(KBUILD)/harddrive.bin
|
||||||
$(QEMU) $(QEMUFLAGS) -kernel $<
|
$(QEMU) $(QEMUFLAGS) -kernel $<
|
||||||
else
|
else
|
||||||
LD=ld
|
LD=ld
|
||||||
QEMUFLAGS+=-machine q35 -smp 4
|
QEMUFLAGS+=-machine q35 -smp 4 -m 256
|
||||||
ifeq ($(kvm),yes)
|
ifeq ($(kvm),yes)
|
||||||
QEMUFLAGS+=-enable-kvm -cpu host
|
QEMUFLAGS+=-enable-kvm -cpu host
|
||||||
endif
|
endif
|
||||||
|
@ -168,6 +169,7 @@ coreutils: \
|
||||||
initfs/bin/realpath
|
initfs/bin/realpath
|
||||||
|
|
||||||
$(BUILD)/initfs.rs: \
|
$(BUILD)/initfs.rs: \
|
||||||
|
initfs/bin/ahcid \
|
||||||
initfs/bin/pcid \
|
initfs/bin/pcid \
|
||||||
initfs/bin/ps2d \
|
initfs/bin/ps2d \
|
||||||
initfs/bin/vesad \
|
initfs/bin/vesad \
|
||||||
|
|
|
@ -44,11 +44,13 @@ impl AreaFrameAllocator {
|
||||||
|
|
||||||
impl FrameAllocator for AreaFrameAllocator {
|
impl FrameAllocator for AreaFrameAllocator {
|
||||||
fn allocate_frames(&mut self, count: usize) -> Option<Frame> {
|
fn allocate_frames(&mut self, count: usize) -> Option<Frame> {
|
||||||
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
|
// "Clone" the frame to return it if it's free. Frame doesn't
|
||||||
// implement Clone, but we can construct an identical frame.
|
// implement Clone, but we can construct an identical frame.
|
||||||
let start_frame = Frame{ number: self.next_free_frame.number };
|
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
|
// the last frame of the current area
|
||||||
let current_area_last_frame = {
|
let current_area_last_frame = {
|
||||||
|
|
|
@ -22,7 +22,6 @@ impl Ahci {
|
||||||
println!("{}: {:?}", i, port_type);
|
println!("{}: {:?}", i, port_type);
|
||||||
match port_type {
|
match port_type {
|
||||||
HbaPortType::SATA => {
|
HbaPortType::SATA => {
|
||||||
/*
|
|
||||||
disk.port.init();
|
disk.port.init();
|
||||||
if let Some(size) = unsafe { disk.port.identify(i) } {
|
if let Some(size) = unsafe { disk.port.identify(i) } {
|
||||||
disk.size = size;
|
disk.size = size;
|
||||||
|
@ -30,8 +29,6 @@ impl Ahci {
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue