2020-02-06 20:20:58 +00:00
|
|
|
#include <kernel/chroma.h>
|
2020-10-18 16:27:07 +00:00
|
|
|
//#include <kernel/system/screen.h>
|
2020-02-06 20:20:58 +00:00
|
|
|
|
2020-08-22 23:48:49 +00:00
|
|
|
/************************
|
|
|
|
*** Team Kitty, 2020 ***
|
|
|
|
*** Chroma ***
|
|
|
|
***********************/
|
|
|
|
|
|
|
|
/* This file is the entry point to the system.
|
|
|
|
* It dictates the order of operations of everything the kernel actually does.
|
|
|
|
* If a function isn't fired here, directly or indirectly, it is not run.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-11 21:59:39 +00:00
|
|
|
size_t KernelAddr = (size_t) &LoadAddr;
|
|
|
|
size_t KernelEnd = (size_t) &end;
|
|
|
|
|
2020-09-03 20:37:03 +00:00
|
|
|
address_space_t KernelAddressSpace;
|
2020-02-06 20:20:58 +00:00
|
|
|
|
2020-08-27 00:39:56 +00:00
|
|
|
int Main(void) {
|
2020-09-03 20:37:03 +00:00
|
|
|
KernelAddressSpace = (address_space_t) {0};
|
2020-04-11 21:59:39 +00:00
|
|
|
|
2020-11-09 18:41:34 +00:00
|
|
|
SerialPrintf("\r\n[ boot] Booting Chroma..\r\n");
|
|
|
|
SerialPrintf("[ boot] Kernel loaded at 0x%p, ends at 0x%p, is %d bytes long.\r\n", KernelAddr, KernelEnd, KernelEnd - KernelAddr);
|
2020-11-28 16:43:43 +00:00
|
|
|
SerialPrintf("[ boot] Initrd is physically at 0x%p, and is %d bytes long.\r\n", bootldr.initrd_ptr, bootldr.initrd_size);
|
2020-12-02 02:33:59 +00:00
|
|
|
SerialPrintf("[ boot] Initrd's header is 0x%p\r\n", FIXENDIAN32(*((volatile uint32_t*)(bootldr.initrd_ptr))));
|
|
|
|
|
|
|
|
ParseKernelHeader(bootldr.initrd_ptr);
|
2020-04-11 21:59:39 +00:00
|
|
|
|
2020-11-09 18:41:34 +00:00
|
|
|
SerialPrintf("[ boot] The bootloader has put the paging tables at 0x%p.\r\n", ReadControlRegister(3));
|
2020-08-27 00:39:56 +00:00
|
|
|
|
2020-09-03 20:37:03 +00:00
|
|
|
//TraversePageTables();
|
2020-08-27 00:39:56 +00:00
|
|
|
|
2020-04-11 21:59:39 +00:00
|
|
|
ListMemoryMap();
|
|
|
|
|
2020-02-06 20:20:58 +00:00
|
|
|
InitPrint();
|
|
|
|
|
2020-04-11 21:59:39 +00:00
|
|
|
WriteStringWithFont("Initty Testing");
|
|
|
|
|
2020-09-25 15:48:20 +00:00
|
|
|
PrepareCPU();
|
2020-02-06 20:20:58 +00:00
|
|
|
|
2020-08-23 01:32:47 +00:00
|
|
|
PCIEnumerate();
|
|
|
|
|
2020-02-06 20:20:58 +00:00
|
|
|
InitMemoryManager();
|
2020-09-03 20:37:03 +00:00
|
|
|
|
2020-09-25 15:48:20 +00:00
|
|
|
//DrawSplash();
|
2020-02-06 20:20:58 +00:00
|
|
|
|
2021-03-15 21:48:51 +00:00
|
|
|
InitPaging();
|
2020-02-06 20:20:58 +00:00
|
|
|
|
2020-04-11 21:59:39 +00:00
|
|
|
|
2020-02-06 20:20:58 +00:00
|
|
|
for(;;) { }
|
2020-08-27 00:39:56 +00:00
|
|
|
|
|
|
|
return 0;
|
2020-02-06 20:20:58 +00:00
|
|
|
|
|
|
|
}
|
2020-08-27 00:39:56 +00:00
|
|
|
|
2020-09-03 20:37:03 +00:00
|
|
|
void SomethingWentWrong(const char* Message) {
|
|
|
|
SerialPrintf("Assertion failed! %s\r\n", Message);
|
|
|
|
//for(;;){}
|
|
|
|
}
|
2020-08-27 00:39:56 +00:00
|
|
|
|
|
|
|
void Exit(int ExitCode) {
|
|
|
|
SerialPrintf("Kernel stopped with code %x\r\n", ExitCode);
|
|
|
|
|
|
|
|
}
|