1.1 --- a/stage2/entry.S Tue Apr 26 14:47:07 2016 +0200
1.2 +++ b/stage2/entry.S Tue Apr 26 15:19:01 2016 +0200
1.3 @@ -42,13 +42,6 @@
1.4 beqz $k1, _tlb_entry_direct
1.5 nop
1.6
1.7 - /* For addresses over 0x00080000... */
1.8 -
1.9 - li $k1, 0xfff80000
1.10 - and $k1, $k0, $k1
1.11 - bnez $k1, _tlb_entry_direct
1.12 - nop
1.13 -
1.14 /* Otherwise, load the page table entries. */
1.15
1.16 andi $k1, $k0, 0xff /* ASID */
2.1 --- a/stage2/stage2.ld Tue Apr 26 14:47:07 2016 +0200
2.2 +++ b/stage2/stage2.ld Tue Apr 26 15:19:01 2016 +0200
2.3 @@ -6,6 +6,8 @@
2.4 /* Program memory section. */
2.5
2.6 . = 0x81c00000;
2.7 + _payload_start = ABSOLUTE(.);
2.8 +
2.9 .text2 : { *(.text*) }
2.10
2.11 . = ALIGN(4);
3.1 --- a/stage2/tasks.c Tue Apr 26 14:47:07 2016 +0200
3.2 +++ b/stage2/tasks.c Tue Apr 26 15:19:01 2016 +0200
3.3 @@ -36,9 +36,13 @@
3.4 const u32 stack_size = 0x00002000;
3.5 const u32 pagesize = 4 * 1024;
3.6
3.7 -/* A reference to the unrelocated symbol table location. */
3.8 +/* A reference to locations for the symbol tables. */
3.9 +
3.10 +extern u32 _got_start, _got_copy_start, _got_copy_end;
3.11
3.12 -extern u32 _got_copy_start;
3.13 +/* A reference to the start of the payload. */
3.14 +
3.15 +extern u32 _payload_start;
3.16
3.17 /* Task management functions. */
3.18
3.19 @@ -56,7 +60,7 @@
3.20
3.21 void start_task(unsigned short task, void (*function)(), u32 args[], u8 nargs)
3.22 {
3.23 - u32 virtual, physical;
3.24 + u32 virtual, physical, address;
3.25
3.26 /*
3.27 Each task employs a stack at a multiple of the given start address in
3.28 @@ -81,6 +85,22 @@
3.29 */
3.30
3.31 init_registers(registers[task], (u32) &_got_copy_start, function, args, nargs);
3.32 +
3.33 + /* Map the global object table for the task. */
3.34 +
3.35 + init_page_table(page_table_start, (u32) &_got_start & 0x7fffffff, (u32) &_got_copy_start & 0x7fffffff, pagesize, 0x1e, task);
3.36 +
3.37 + /* Map all shared pages for the task. */
3.38 +
3.39 + for (address = (u32) &_payload_start; address < (u32) &_got_start; address += pagesize * 2)
3.40 + {
3.41 + init_page_table(page_table_start, address & 0x7fffffff, address & 0x7fffffff, pagesize, 0x1e, task);
3.42 + }
3.43 +
3.44 + for (address = (u32) &_got_copy_end + pagesize * 2; address < 0x82000000; address += pagesize * 2)
3.45 + {
3.46 + init_page_table(page_table_start, address & 0x7fffffff, address & 0x7fffffff, pagesize, 0x1e, task);
3.47 + }
3.48 }
3.49
3.50 void start_task_now()