push
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
|
||||
; Pointer to Long Mode Global Descriptor Table (GDT, arch/gdt.cc)
|
||||
[EXTERN gdt_long_mode_pointer]
|
||||
|
||||
[GLOBAL long_mode]
|
||||
long_mode:
|
||||
|
||||
@@ -247,7 +246,6 @@ long_mode_start:
|
||||
|
||||
; Call high-level (C++) kernel initialization function
|
||||
call kernel_init
|
||||
|
||||
; Print `STOP` to screen and stop
|
||||
mov rax, 0x2f502f4f2f544f53
|
||||
mov qword [0xb8000], rax
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "../compiler/libc.h"
|
||||
#include "../debug/output.h"
|
||||
#include "../interrupt/handlers.h"
|
||||
|
||||
#include "../memory/pageframealloc.h"
|
||||
extern "C" [[noreturn]] void kernel_init() {
|
||||
// Setup and load Interrupt Description Table (IDT)
|
||||
initInterruptHandlers();
|
||||
@@ -16,7 +16,9 @@ extern "C" [[noreturn]] void kernel_init() {
|
||||
// Initialize PICs
|
||||
PIC::initialize();
|
||||
|
||||
// Call global constructors
|
||||
PageFrameAllocator::init();
|
||||
|
||||
// Call global constructors
|
||||
CSU::initializer();
|
||||
|
||||
//Select 5th Segment in GDT. 5<<3 == 0x28
|
||||
|
||||
@@ -13,8 +13,14 @@
|
||||
#include "./device/serialstream.h"
|
||||
|
||||
// Separate title window on first line (for simplicity at scrolling)
|
||||
|
||||
void PageFrameAllocator::init();
|
||||
|
||||
|
||||
static TextStream tout(0, CGA::COLUMNS, 0, 1);
|
||||
|
||||
|
||||
|
||||
SerialStream sout;
|
||||
|
||||
TextStream dout(0, 80, 17, 25);
|
||||
@@ -40,12 +46,11 @@ alignas(4096) four_lvl_paging_t paging_tree;
|
||||
static const uint32_t NUM_APPS = 9;
|
||||
Application apps[NUM_APPS];
|
||||
|
||||
static KeyboardApplication kapp;
|
||||
//static KeyboardApplication kapp;
|
||||
|
||||
// Main function
|
||||
extern "C" int main() {
|
||||
|
||||
PageFrameAllocator::init();
|
||||
memset(&paging_tree, 0, sizeof(four_lvl_paging_t));
|
||||
create_basic_page_table((uintptr_t)&paging_tree);
|
||||
load_cr3((void*)&paging_tree.l4);
|
||||
@@ -76,7 +81,7 @@ extern "C" int main() {
|
||||
g.vault().scheduler.ready(&(apps[i]));
|
||||
}
|
||||
|
||||
g.vault().scheduler.ready(&kapp);
|
||||
//g.vault().scheduler.ready(&kapp);
|
||||
|
||||
// Enable Interrupts
|
||||
Core::Interrupt::enable();
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
PageFrame PageFrameAllocator::PageFrames[4294967296 / 4096];
|
||||
|
||||
void mark_pageframes(uintptr_t start, uintptr_t end, bool available){
|
||||
DBG << "start: " << hex << start << " end: " << end;
|
||||
// DBG << "start: " << hex << start << " end: " << end;
|
||||
start = Page::floor(start);
|
||||
end = Page::ceil(end);
|
||||
if(start > 4294967296)
|
||||
start = 4294967296;
|
||||
if(end > 4294967296)
|
||||
end = 4294967296;
|
||||
DBG << " page start: " << hex << start << " end: " << end << endl;
|
||||
//DBG << " page start: " << hex << start << " end: " << end << endl;
|
||||
|
||||
for(uint64_t i = start; i < end; i += 4096){
|
||||
uint64_t pg = i/4096;
|
||||
@@ -62,19 +62,14 @@ void PageFrameAllocator::init(){
|
||||
}
|
||||
|
||||
//mark other known regions as unavailable
|
||||
DBG << "kernel image ";
|
||||
mark_pageframes((uintptr_t)&___KERNEL_START___, (uintptr_t)&___KERNEL_END___, false);
|
||||
|
||||
DBG << "ISA adresses ";
|
||||
mark_pageframes(0x00F00000, 0x00FFFFFF, false);
|
||||
|
||||
DBG << "LAPIC ";
|
||||
mark_pageframes(0xfee00000, 0xfee003f0, false);
|
||||
|
||||
DBG << "IO APIC ";
|
||||
mark_pageframes(APIC::getIOAPICAddress(), APIC::getIOAPICAddress()+0x10, false);
|
||||
|
||||
stats();
|
||||
}
|
||||
|
||||
void PageFrameAllocator::stats(){
|
||||
|
||||
Reference in New Issue
Block a user