/// Search for the MP Floating Pointer Structure, which according to the
/// spec is in one of the following three locations:
/// 1) in the first KB of the EBDA;
/// 2) in the last KB of system base memory;
/// 3) in the BIOS ROM address space between 0F0000h and 0FFFFFh.
Search for the MP Floating Pointer Structure, which according to the
spec is in one of the following three locations:
1) in the first KB of the EBDA;
2) in the last KB of system base memory;
3) in the BIOS ROM address space between 0F0000h and 0FFFFFh.
Search for the MP Floating Pointer Structure which according to the spec is in one of the following three locations : 1 ) in the first KB of the EBDA ; 2 ) in the last KB of system base memory ; 3 ) in the BIOS ROM address space between 0F0000h and 0FFFFFh .
pub fn find_mp() -> Option<*const MP>
{
	use core::mem::size_of;
	use utils::find_in_memory;
	let ebda = unsafe { *(0x40E as *const u16) as usize } << 4;
	if ebda != 0 {
		let res = unsafe{ find_in_memory::<MP>(ebda, 1024, size_of::<MP>()) };
		if let Some(addr) = res {
			return Some(addr as *const MP);
		}
	}
	let p = unsafe { *(0x413 as *const u16) as usize } << 10;
	let res = unsafe{ find_in_memory::<MP>(p-1024, 1024, size_of::<MP>()) };
    if let Some(addr) = res {
		return Some(addr as *const MP);
	}
	let res = unsafe{ find_in_memory::<MP>(0xF0000, 0x10000, size_of::<MP>()) };
	res.map(|addr| addr as *const MP)
}
pub fn find_mp ( ) -> Option < * const MP > { use core :: mem :: size_of ; use utils :: find_in_memory ; let ebda = unsafe { * ( 0x40E as * const u16 ) as usize } << 4 ; if ebda != 0 { let res = unsafe { find_in_memory :: < MP > ( ebda , 1024 , size_of :: < MP > ( ) ) } ; if let Some ( addr ) = res { return Some ( addr as * const MP ) ; } } let p = unsafe { * ( 0x413 as * const u16 ) as usize } << 10 ; let res = unsafe { find_in_memory :: < MP > ( p - 1024 , 1024 , size_of :: < MP > ( ) ) } ; if let Some ( addr ) = res { return Some ( addr as * const MP ) ; } let res = unsafe { find_in_memory :: < MP > ( 0xF0000 , 0x10000 , size_of :: < MP > ( ) ) } ; res . map ( | addr | addr as * const MP ) }
Search for the MP Floating Pointer Structure, which according to the
spec is in one of the following three locations:
1) in the first KB of the EBDA;
2) in the last KB of system base memory;
3) in the BIOS ROM address space between 0F0000h and 0FFFFFh.
Search for the MP Floating Pointer Structure which according to the spec is in one of the following three locations : 1 ) in the first KB of the EBDA ; 2 ) in the last KB of system base memory ; 3 ) in the BIOS ROM address space between 0F0000h and 0FFFFFh .