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 {