blob: 8db2e509940f04370bfb4db9b49b85f66afd97b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#include <stdbool.h>
#include <serial.h>
#include <printf.h>
#include <paging.h>
#include <video.h>
#include <acpi.h>
void panic() { // will fill with debugging info latter
printf("Kernel panic!\n");
for(;;);
}
void main() {
if(!(init_serial(COM1))) {
printf("\nKernal started on CPU 1!\n"); // will detect cpu later
}
rsdp_t *rsdp;
struct memory_table *table = (struct memory_table *)&_meminfo_loc;
struct vbe_infoblock *vbe_info = (struct vbe_infoblock *)0x500;
debug_print_memory();
rsdp = find_RSDP();
if(!(rsdp)) {
printf("Couldn't find the RSDP... uhh, not sure what to do now.\n");
panic();
}
dump_video();
if(rsdp->v1.version) {
map_page(0x200000, (rsdp->v2.xsdt_addr / 0x1000) * 0x1000, PAGE_SIZE_4K);
}
else {
map_page(0x200000, (rsdp->v1.rsdt_addr / 0x1000) * 0x1000, PAGE_SIZE_4K);
struct acpi_header *acpi = (struct acpi_header *)((uint64_t)0x200000 + (rsdp->v1.rsdt_addr % 0x1000));
}
printf("kernel is done, you can ignore this panic\n");
panic();
}
|