# HG changeset patch # User Paul Boddie # Date 1461676741 -7200 # Node ID a2a0be47d91bef1ae079941cc7d4c26b0c77df4e # Parent 0092a96764be83754fc17b89f13c71ad307cce8e Attempted to map the relocated object table into each task, using explicit direct mappings and thus removing the special region-based test in the TLB handler. diff -r 0092a96764be -r a2a0be47d91b stage2/entry.S --- a/stage2/entry.S Tue Apr 26 14:47:07 2016 +0200 +++ b/stage2/entry.S Tue Apr 26 15:19:01 2016 +0200 @@ -42,13 +42,6 @@ beqz $k1, _tlb_entry_direct nop - /* For addresses over 0x00080000... */ - - li $k1, 0xfff80000 - and $k1, $k0, $k1 - bnez $k1, _tlb_entry_direct - nop - /* Otherwise, load the page table entries. */ andi $k1, $k0, 0xff /* ASID */ diff -r 0092a96764be -r a2a0be47d91b stage2/stage2.ld --- a/stage2/stage2.ld Tue Apr 26 14:47:07 2016 +0200 +++ b/stage2/stage2.ld Tue Apr 26 15:19:01 2016 +0200 @@ -6,6 +6,8 @@ /* Program memory section. */ . = 0x81c00000; + _payload_start = ABSOLUTE(.); + .text2 : { *(.text*) } . = ALIGN(4); diff -r 0092a96764be -r a2a0be47d91b stage2/tasks.c --- a/stage2/tasks.c Tue Apr 26 14:47:07 2016 +0200 +++ b/stage2/tasks.c Tue Apr 26 15:19:01 2016 +0200 @@ -36,9 +36,13 @@ const u32 stack_size = 0x00002000; const u32 pagesize = 4 * 1024; -/* A reference to the unrelocated symbol table location. */ +/* A reference to locations for the symbol tables. */ + +extern u32 _got_start, _got_copy_start, _got_copy_end; -extern u32 _got_copy_start; +/* A reference to the start of the payload. */ + +extern u32 _payload_start; /* Task management functions. */ @@ -56,7 +60,7 @@ void start_task(unsigned short task, void (*function)(), u32 args[], u8 nargs) { - u32 virtual, physical; + u32 virtual, physical, address; /* Each task employs a stack at a multiple of the given start address in @@ -81,6 +85,22 @@ */ init_registers(registers[task], (u32) &_got_copy_start, function, args, nargs); + + /* Map the global object table for the task. */ + + init_page_table(page_table_start, (u32) &_got_start & 0x7fffffff, (u32) &_got_copy_start & 0x7fffffff, pagesize, 0x1e, task); + + /* Map all shared pages for the task. */ + + for (address = (u32) &_payload_start; address < (u32) &_got_start; address += pagesize * 2) + { + init_page_table(page_table_start, address & 0x7fffffff, address & 0x7fffffff, pagesize, 0x1e, task); + } + + for (address = (u32) &_got_copy_end + pagesize * 2; address < 0x82000000; address += pagesize * 2) + { + init_page_table(page_table_start, address & 0x7fffffff, address & 0x7fffffff, pagesize, 0x1e, task); + } } void start_task_now()