// Search for the MP Floating Pointer Structure, which according to // [MP 4] is in one of the following three locations: // 1) in the first KB of the EBDA; // 2) if there is no EBDA, in the last KB of system base memory; // 3) in the BIOS ROM between 0xE0000 and 0xFFFFF. static struct mp * mpsearch(void) { uint8_t *bda; uint32_t p; struct mp *mp; static_assert(sizeof(*mp) == 16); // The BIOS data area lives in 16-bit segment 0x40. bda = (uint8_t *) KADDR(0x40 << 4); // [MP 4] The 16-bit segment of the EBDA is in the two bytes // starting at byte 0x0E of the BDA. 0 if not present. if ((p = *(uint16_t *) (bda + 0x0E))) { p <<= 4; // Translate from segment to PA if ((mp = mpsearch1(p, 1024))) return mp; } else { // The size of base memory, in KB is in the two bytes // starting at 0x13 of the BDA. p = *(uint16_t *) (bda + 0x13) * 1024; if ((mp = mpsearch1(p - 1024, 1024))) return mp; } return mpsearch1(0xF0000, 0x10000); }
// 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 between 0xE0000 and 0xFFFFF. static struct mp* mpsearch(void) { uchar *bda; uint p; struct mp *mp; bda = (uchar *) P2V(0x400); if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){ if((mp = mpsearch1(p, 1024))) return mp; } else { p = ((bda[0x14]<<8)|bda[0x13])*1024; if((mp = mpsearch1(p-1024, 1024))) return mp; } return mpsearch1(0xF0000, 0x10000); }
// 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 between 0xE0000 and 0xFFFFF. static struct mp * mpsearch(void) { uint8_t *bda; uintptr_t p; struct mp *mp; bda = (uint8_t *) 0x400; if ((p = ((bda[0x0F] << 8) | bda[0x0E]) << 4)) { if ((mp = mpsearch1((uint8_t *) p, 1024))) return mp; } else { p = ((bda[0x14] << 8) | bda[0x13]) * 1024; if ((mp = mpsearch1((uint8_t *) p - 1024, 1024))) return mp; } return mpsearch1((uint8_t *) 0xF0000, 0x10000); }