71 lines
1.5 KiB
C
71 lines
1.5 KiB
C
#include <string.h>
|
|
#include <system.h>
|
|
#include <conio.h>
|
|
#include <hal.h>
|
|
#include <time.h>
|
|
#include <bootinfo.h>
|
|
#include "memory/mmngr_ph.h"
|
|
#include "shell/shell.c"
|
|
|
|
//! format of a memory region
|
|
typedef struct {
|
|
|
|
uint32_t startLo;
|
|
uint32_t startHi;
|
|
uint32_t sizeLo;
|
|
uint32_t sizeHi;
|
|
uint32_t type;
|
|
uint32_t acpi_3_0;
|
|
} memory_region ;
|
|
|
|
//! different memory regions (in memory_region.type)
|
|
char* strMemoryTypes[] = {
|
|
"",
|
|
"Available", //memory_region.type==0
|
|
"Reserved", //memory_region.type==1
|
|
"ACPI Reclaim", //memory_region.type==2
|
|
"ACPI NVS Memory" //memory_region.type==3
|
|
};
|
|
|
|
extern dword _code;
|
|
extern dword _data;
|
|
extern dword _bss;
|
|
extern dword _end;
|
|
|
|
void k_init(multiboot_info* bootinfo)
|
|
{
|
|
// Start by zero-ing the bss
|
|
memset(&_bss, 0, &_end - &_bss);
|
|
|
|
// Initialize HAL
|
|
i86_hal_initialize();
|
|
|
|
// Initialize Graphics
|
|
graphics_init();
|
|
|
|
// cleanup the console screen
|
|
set_default_colors (0x07, 0x04);
|
|
clrscr();
|
|
|
|
|
|
// Start memory manager
|
|
uint32_t memSize = 1024 + bootinfo->m_memoryLo + bootinfo->m_memoryHi*64;
|
|
memory_region* memMap = (memory_region*)0x1000;
|
|
pmmngr_init (memSize, (uint32_t)&_end);
|
|
|
|
unsigned int i;
|
|
|
|
for (i=0; (memMap[i].sizeHi != 0 || memMap[i].sizeLo != 0) && i<3; ++i)
|
|
if (memMap[i].type==1) pmmngr_init_region (memMap[i].startLo, memMap[i].sizeLo);
|
|
|
|
}
|
|
|
|
void k_main(uint32_t kernel_size, multiboot_info* bootinfo)
|
|
{
|
|
k_init(bootinfo);
|
|
apps_osver();
|
|
|
|
shell();
|
|
|
|
for(;;);
|
|
} |