Fix allocate_frames
This commit is contained in:
		
							parent
							
								
									dad81d3c46
								
							
						
					
					
						commit
						d72609898a
					
				
					 3 changed files with 7 additions and 6 deletions
				
			
		
							
								
								
									
										4
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								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 \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,11 +44,13 @@ impl AreaFrameAllocator {
 | 
			
		|||
 | 
			
		||||
impl FrameAllocator for AreaFrameAllocator {
 | 
			
		||||
    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
 | 
			
		||||
            // 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 = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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,
 | 
			
		||||
                  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue