From 5ac343a2e8d517e3957fbf1bb1999f9a25e46951 Mon Sep 17 00:00:00 2001 From: josh Date: Wed, 27 Jan 2010 05:25:05 +0000 Subject: [PATCH] fixed mm bug, now crashing because IDT isn't mapped via paging git-svn-id: svn://anubis/hos/trunk@97 5b3e749e-e535-0410-8002-a9bb6afbdfca --- kernel/Makefile | 4 ++-- kernel/mm/mm.cc | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/kernel/Makefile b/kernel/Makefile index 260cd38..704ae1a 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -11,8 +11,8 @@ export HOS_TOPLEVEL := $(shell pwd) LDSCRIPT := link.ld KERNEL := hos export CPPFLAGS := -I$(HOS_TOPLEVEL) -I$(HOS_TOPLEVEL)/include -export CFLAGS := -Wall -O2 -export CXXFLAGS := -Wall -O2 -fno-rtti -fno-exceptions +export CFLAGS := -Wall -O2 -g +export CXXFLAGS := -Wall -O2 -fno-rtti -fno-exceptions -g export LDFLAGS := -T $(LDSCRIPT) -Map $(KERNEL).map export LDLIBS := `$(CC) -print-libgcc-file-name` diff --git a/kernel/mm/mm.cc b/kernel/mm/mm.cc index 2c223b6..8f427f6 100644 --- a/kernel/mm/mm.cc +++ b/kernel/mm/mm.cc @@ -192,10 +192,11 @@ void mm_bootstrap() /* set the page directory base register */ write_cr3(page_directory_phys); + /* set up permanent stack before enabling paging */ + stack_bootstrap(); + /* turn on paging */ write_cr0(read_cr0() | (1 << 31)); - - stack_bootstrap(); } /************************************************************************** @@ -210,6 +211,7 @@ static void record_phys_page(u32_t base_address) last_page_alloc_page++; page_alloc_pages_index++; page_alloc_page_numbers[last_page_alloc_page] = base_address; + page_alloc_page_index = 0; } else {