1.1 --- a/stage2/entry.S Mon Apr 25 21:56:49 2016 +0200
1.2 +++ b/stage2/entry.S Mon Apr 25 23:05:44 2016 +0200
1.3 @@ -21,7 +21,7 @@
1.4 .extern interrupt_handler
1.5 .extern current_registers
1.6 .extern current_stack_pointer
1.7 -.extern _payload_end
1.8 +.extern _shared_end
1.9 .globl _tlb_entry
1.10 .globl _exc_entry
1.11 .globl _irq_entry
1.12 @@ -43,10 +43,10 @@
1.13 beqz $k1, _tlb_entry_direct
1.14 nop
1.15
1.16 - /* For addresses beyond the relocated global object table... */
1.17 + /* For addresses beyond the program and data... */
1.18
1.19 - lui $k1, %hi(_payload_end - 0x80000000)
1.20 - ori $k1, $k1, %lo(_payload_end - 0x80000000)
1.21 + lui $k1, %hi(_shared_end - 0x80000000)
1.22 + ori $k1, $k1, %lo(_shared_end - 0x80000000)
1.23 sltu $k1, $k1, $k0
1.24 bnez $k1, _tlb_entry_direct
1.25 nop
2.1 --- a/stage2/head2.S Mon Apr 25 21:56:49 2016 +0200
2.2 +++ b/stage2/head2.S Mon Apr 25 23:05:44 2016 +0200
2.3 @@ -30,7 +30,7 @@
2.4 .extern _end_entries
2.5 .extern _got_start
2.6 .extern _got_end
2.7 -.extern _got_copy_start
2.8 +.extern _payload_start
2.9 .extern enter_task
2.10 .globl _start
2.11 .globl _enter_task
2.12 @@ -89,10 +89,13 @@
2.13
2.14 /* Copy the offset table for user mode programs. */
2.15
2.16 + li $t3, 0x80000000 /* adjustment */
2.17 la $t0, _got_start /* start */
2.18 - la $t1, _got_copy_start
2.19 + la $t1, _payload_start
2.20 + subu $t1, $t0, $t1
2.21 + addiu $t1, $t1, 0x1000
2.22 + addu $t1, $t1, $t3 /* target = start - payload start + 0x80001000 */
2.23 la $t2, _got_end /* end */
2.24 - li $t3, 0x80000000 /* adjustment */
2.25 jal _copy_adjust
2.26 nop
2.27
3.1 --- a/stage2/stage2.ld Mon Apr 25 21:56:49 2016 +0200
3.2 +++ b/stage2/stage2.ld Mon Apr 25 23:05:44 2016 +0200
3.3 @@ -21,33 +21,18 @@
3.4 . = ALIGN(4);
3.5 .data : { *(.data*) *(.scommon*) *(.reginfo*) }
3.6
3.7 - _shared_end = ABSOLUTE(.);
3.8 -
3.9 . = ALIGN(4);
3.10 -
3.11 - _bss_start = ABSOLUTE(.);
3.12 -
3.13 .sbss : { *(.sbss*) }
3.14 .bss : { *(.bss*) }
3.15 +
3.16 . = ALIGN (4);
3.17 -
3.18 - _bss_end = ABSOLUTE(.);
3.19 -
3.20 - /* The global object table. */
3.21 + _shared_end = ABSOLUTE(.);
3.22
3.23 .got : ALIGN(4096) {
3.24 _gp = ALIGN(16);
3.25 _got_start = ABSOLUTE(.);
3.26 - *(.got*)
3.27 + *(.got*)
3.28 }
3.29 _got_end = ABSOLUTE(.);
3.30 -
3.31 - /* The relocated copy of the global object table. */
3.32 -
3.33 - .got_copy : ALIGN(4096) {
3.34 - _got_copy_start = ABSOLUTE(.);
3.35 - . += _got_end - _got_start - 1;
3.36 - }
3.37 - _got_copy_end = ABSOLUTE(.);
3.38 _payload_end = ABSOLUTE(.);
3.39 }
4.1 --- a/stage2/tasks.c Mon Apr 25 21:56:49 2016 +0200
4.2 +++ b/stage2/tasks.c Mon Apr 25 23:05:44 2016 +0200
4.3 @@ -36,16 +36,13 @@
4.4 const u32 stack_size = 0x00002000;
4.5 const u32 pagesize = 4 * 1024;
4.6
4.7 -/*
4.8 -References to the unrelocated symbol table and to the relocated version, both in
4.9 -their original locations.
4.10 -*/
4.11 +/* Reference to the unrelocated symbol table. */
4.12
4.13 -extern u32 _got_start, _got_copy_start;
4.14 +extern u32 _got_start;
4.15
4.16 /* Regions to be mapped directly. */
4.17
4.18 -extern u32 _shared_start, _shared_end;
4.19 +extern u32 _payload_start, _shared_start, _shared_end;
4.20
4.21 /* Task management functions. */
4.22
4.23 @@ -64,6 +61,7 @@
4.24 void start_task(unsigned short task, void (*function)(), u32 args[], u8 nargs)
4.25 {
4.26 u32 virtual, physical, address;
4.27 + u32 _got_copy_start = (u32) &_got_start - (u32) &_payload_start + 0x1000;
4.28
4.29 /*
4.30 Each task employs a stack at a multiple of the given start address in