Fix error returned from set_mmap
This commit is contained in:
parent
a3642f482a
commit
7be4052928
@ -23,6 +23,7 @@ pub const FLAG_UPPER: u32 = 1 << 2;
|
||||
|
||||
pub enum Error {
|
||||
BufferTooSmall,
|
||||
BadPointer,
|
||||
Error
|
||||
}
|
||||
|
||||
|
@ -30,13 +30,13 @@ impl LoadProtocol for ProtoV1 {
|
||||
if self.memory_map.size == 0 || self.memory_map.address == 0 {
|
||||
// Memory map pointer is stored
|
||||
if ptr >= 0x100000000 as *const _ {
|
||||
panic!("Memory map pointer crosses 4GiB");
|
||||
return Err(Error::BadPointer);
|
||||
}
|
||||
|
||||
self.memory_map.address = map.address;
|
||||
} else {
|
||||
if map.size > self.memory_map.size {
|
||||
panic!("Can't fit memory map");
|
||||
return Err(Error::BufferTooSmall);
|
||||
}
|
||||
unsafe {
|
||||
extern "C" {
|
||||
@ -48,8 +48,7 @@ impl LoadProtocol for ProtoV1 {
|
||||
|
||||
self.memory_map.size = map.size;
|
||||
self.memory_map.entsize = map.entsize;
|
||||
|
||||
Err(Error::BufferTooSmall)
|
||||
Ok(())
|
||||
}
|
||||
fn set_initrd(&mut self, base: usize, size: usize) {
|
||||
if self.initrd_base + self.initrd_size >= 0x100000000 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user