[Stage1] Add HEX display to screen.h [Stage1] Handle IRQ1 semi-gracefully [Stage1] Try (unsuccessfully) to "wait" for IRQ 1 (os_interrupt_wait())
60 lines
No EOL
1.3 KiB
C
60 lines
No EOL
1.3 KiB
C
#include "include/rsdp.h"
|
|
#include "include/utils.h"
|
|
#include "include/screen.h"
|
|
|
|
OS_RSDPDescriptor* os_find_RSDP() {
|
|
os_u16* ebda_addr_raw = (os_u16*)0x40E;
|
|
os_u32 ebda_addr_0 = ((os_u32)(*ebda_addr_raw));
|
|
os_u32 ebda_addr = ebda_addr_0 << 4;
|
|
os_u8* ebda = (os_u8*)ebda_addr;
|
|
os_u8* current_ptr = ebda;
|
|
|
|
while((os_u32)(current_ptr - ebda) < 1024) {
|
|
if (os_data_compare(current_ptr, (os_u8*)OS_RSDP_SIG, 8) == OS_TRUE) {
|
|
OS_RSDPDescriptor* ptr = (OS_RSDPDescriptor*)current_ptr;
|
|
|
|
os_u32 sum = 0;
|
|
for(os_u32 i = 0; i < sizeof(OS_RSDPDescriptor); i++) {
|
|
sum += current_ptr[i];
|
|
}
|
|
|
|
if (((os_u8) sum) != 0) {
|
|
current_ptr += 16;
|
|
continue;
|
|
}
|
|
|
|
return ptr;
|
|
}
|
|
current_ptr += 16;
|
|
}
|
|
|
|
os_u8* bios_area_ptr = (os_u8*)0x000E0000;
|
|
os_u8* bios_end_ptr = (os_u8*)0x000E0000 + 0x20000;
|
|
current_ptr = bios_area_ptr;
|
|
|
|
while(current_ptr < bios_end_ptr) {
|
|
if (os_data_compare(current_ptr, (os_u8*)OS_RSDP_SIG, 8) == OS_TRUE) {
|
|
OS_RSDPDescriptor* ptr = (OS_RSDPDescriptor*)current_ptr;
|
|
|
|
os_u32 sum = 0;
|
|
for(os_u32 i = 0; i < sizeof(OS_RSDPDescriptor); i++) {
|
|
sum += current_ptr[i];
|
|
}
|
|
|
|
if (((os_u8) sum) != 0) {
|
|
current_ptr += 16;
|
|
continue;
|
|
}
|
|
|
|
return ptr;
|
|
}
|
|
current_ptr += 16;
|
|
}
|
|
|
|
|
|
return (OS_RSDPDescriptor*)0;
|
|
}
|
|
|
|
OS_RSDPDescriptor_20* os_find_RSDP_20() {
|
|
return (OS_RSDPDescriptor_20*)0;
|
|
} |