Add defs required for kernel to compile

This commit is contained in:
Curle 2020-09-03 21:37:03 +01:00
parent 25d8f97693
commit 8665e4c634
Signed by: TheCurle
GPG Key ID: 5942F13718443F79
2 changed files with 16 additions and 3 deletions

View File

@ -19,12 +19,16 @@
#include <kernel/system/memory.h> #include <kernel/system/memory.h>
#include <kernel/system/pci.h> #include <kernel/system/pci.h>
#include <kernel/system/screen.h>
extern size_t LoadAddr; extern size_t LoadAddr;
extern bootinfo bootldr; extern bootinfo bootldr;
extern unsigned char* environment; extern unsigned char* environment;
extern uint8_t fb; extern uint8_t fb;
extern volatile unsigned char _binary_font_psf_start; extern volatile unsigned char _binary_font_psf_start;
extern address_space_t KernelAddressSpace;
typedef struct { typedef struct {
uint32_t magic; uint32_t magic;
uint32_t version; uint32_t version;
@ -62,3 +66,5 @@ void SetupIDT();
int Main(); int Main();
void Exit(); void Exit();
void SomethingWentWrong(const char* Message);

View File

@ -1,4 +1,5 @@
#include <kernel/chroma.h> #include <kernel/chroma.h>
#include <kernel/system/screen.h>
/************************ /************************
*** Team Kitty, 2020 *** *** Team Kitty, 2020 ***
@ -15,16 +16,17 @@
size_t KernelAddr = (size_t) &LoadAddr; size_t KernelAddr = (size_t) &LoadAddr;
size_t KernelEnd = (size_t) &end; size_t KernelEnd = (size_t) &end;
address_space_t KernelAddressSpace;
int Main(void) { int Main(void) {
KernelAddressSpace = (address_space_t) {0};
SerialPrintf("\r\nBooting Chroma..\r\n"); SerialPrintf("\r\nBooting Chroma..\r\n");
SerialPrintf("Kernel loaded at 0x%p, ends at 0x%p, is %d bytes long.\r\n", KernelAddr, KernelEnd, KernelEnd - KernelAddr); SerialPrintf("Kernel loaded at 0x%p, ends at 0x%p, is %d bytes long.\r\n", KernelAddr, KernelEnd, KernelEnd - KernelAddr);
SerialPrintf("The bootloader has put the paging tables at 0x%p.\r\n", ReadControlRegister(3)); SerialPrintf("The bootloader has put the paging tables at 0x%p.\r\n", ReadControlRegister(3));
TraversePageTables(); //TraversePageTables();
ListMemoryMap(); ListMemoryMap();
@ -39,7 +41,8 @@ int Main(void) {
PCIEnumerate(); PCIEnumerate();
InitMemoryManager(); InitMemoryManager();
MemoryTest();
DrawSplash();
InitPaging(); InitPaging();
@ -50,6 +53,10 @@ int Main(void) {
} }
void SomethingWentWrong(const char* Message) {
SerialPrintf("Assertion failed! %s\r\n", Message);
//for(;;){}
}
void Exit(int ExitCode) { void Exit(int ExitCode) {
SerialPrintf("Kernel stopped with code %x\r\n", ExitCode); SerialPrintf("Kernel stopped with code %x\r\n", ExitCode);