# HG changeset patch # User Paul Boddie # Date 1456597232 -3600 # Node ID d323b7b054242034056bf9c1f013e1f2746ddcfc # Parent 4502cd6c72549075041124c1e0f1053dca9e3058 Put the page tables and the stacks in unmapped space, with the stacks occupying distinct virtual addresses and thus not employing the page tables. diff -r 4502cd6c7254 -r d323b7b05424 stage2/cpu.c --- a/stage2/cpu.c Sat Feb 27 18:34:50 2016 +0100 +++ b/stage2/cpu.c Sat Feb 27 19:20:32 2016 +0100 @@ -177,7 +177,7 @@ /* Wire in the kseg0 mapping and the page tables. */ asm volatile( - "li $t1, 2\n" /* index of first randomly-replaced entry */ + "li $t1, 1\n" /* index of first randomly-replaced entry */ "mtc0 $t1, $6\n" /* CP0_WIRED */ "mtc0 $zero, $4\n" /* CP0_CONTEXT */ "mtc0 $zero, $10\n" /* CP0_ENTRYHI */ @@ -186,10 +186,6 @@ /* Map the code, making it globally available. */ map_page_index(0x80000000, 0x00000000, 16 * 1024 * 1024, 0x1f, 0, 0); - - /* Map the page tables. */ - - map_page_index(page_table_start, page_table_start, 64 * 1024, 0x1f, 0, 1); } void map_page_index(u32 virtual, u32 physical, u32 pagesize, u8 flags, u8 asid, u32 index) diff -r 4502cd6c7254 -r d323b7b05424 stage2/cpu.h --- a/stage2/cpu.h Sat Feb 27 18:34:50 2016 +0100 +++ b/stage2/cpu.h Sat Feb 27 19:20:32 2016 +0100 @@ -17,7 +17,7 @@ void map_page_index(u32, u32, u32, u8, u8, u32); void unmap_page(u32, u32, u32, u8, u8); -#define page_table_start 0x00040000 +#define page_table_start 0x80040000 #define page_table_task_size 0x00008000 #define page_table_task_size_log2 15 diff -r 4502cd6c7254 -r d323b7b05424 stage2/entry.S --- a/stage2/entry.S Sat Feb 27 18:34:50 2016 +0100 +++ b/stage2/entry.S Sat Feb 27 19:20:32 2016 +0100 @@ -27,7 +27,7 @@ /* NOTE: Duplicated from cpu.h. */ -#define page_table_start 0x00040000 +#define page_table_start 0x80040000 #define page_table_task_size_log2 15 _tlb_entry: diff -r 4502cd6c7254 -r d323b7b05424 stage2/irq.c --- a/stage2/irq.c Sat Feb 27 18:34:50 2016 +0100 +++ b/stage2/irq.c Sat Feb 27 19:20:32 2016 +0100 @@ -51,7 +51,7 @@ u32 current_stack_pointer; extern u32 _got_copy_start; -const u32 stack_start = 0x00080000; +const u32 stack_start = 0x80080000; const u32 stack_size = 0x00002000; const u32 pagesize = 4 * 1024; const u32 framesize = 120; /* see the handlers */ @@ -89,7 +89,7 @@ /* Switch task. */ - /* switch_task(); */ + switch_task(); /* Clear interrupt status. */ @@ -116,15 +116,11 @@ physical memory, but at the same address in virtual memory. */ - virtual = stack_start; physical = stack_start + stack_size * task; + virtual = physical; init_page_table(page_table_start, virtual - pagesize * 2, physical - pagesize * 2, pagesize, 0x1e, task); - /* Map the page for initialisation. */ - - map_page(physical, physical, pagesize, 0x1e, 0); - /* Set the stack for the new task, initialising the global pointer and return address. diff -r 4502cd6c7254 -r d323b7b05424 stage2/stage2.c --- a/stage2/stage2.c Sat Feb 27 18:34:50 2016 +0100 +++ b/stage2/stage2.c Sat Feb 27 19:20:32 2016 +0100 @@ -50,7 +50,6 @@ start_task(1); start_task(2); - invoke_task(1); /* Now, wait for the tasks to be selected as interrupts occur. */