# HG changeset patch # User Paul Boddie # Date 1540585666 -7200 # Node ID 5441add474f52e7374ab10b667463e6309b95db3 # Parent fda3e3afe979e12503d84e7d88394e4f2a6dcd40 Fixed the relocation function, enabling the vga example again. diff -r fda3e3afe979 -r 5441add474f5 lib/payload.c --- a/lib/payload.c Fri Oct 26 20:51:25 2018 +0200 +++ b/lib/payload.c Fri Oct 26 22:27:46 2018 +0200 @@ -19,11 +19,19 @@ #include +extern uint8_t _data_original, _data; + +/* This is defined using SIZEOF and its table entry contains the actual value. + Its "address" provided by the table is therefore the value! */ + +extern uint32_t _data_size; + /* Relocate the .data section's contents to initialise mutable structures. */ -void relocate_data(uint8_t *original, uint8_t *current, uint32_t size) +void relocate_data(void) { - uint8_t *limit = original + size; + uint8_t *original = &_data_original, *current = &_data, + *limit = original + (uint32_t) &_data_size; /* Copy data from program memory to the relocated data area in RAM. */ diff -r fda3e3afe979 -r 5441add474f5 lib/start.S --- a/lib/start.S Fri Oct 26 20:51:25 2018 +0200 +++ b/lib/start.S Fri Oct 26 22:27:46 2018 +0200 @@ -45,9 +45,6 @@ .globl _start .extern relocate_data -.extern _data_original -.extern _data -.extern _data_size .extern main _start: @@ -77,11 +74,6 @@ /* Relocate mutable data and then jump to the main program. */ - la $a0, _data_original - la $a1, _data - la $a2, _data_size - lw $a2, 0($a2) - la $t9, relocate_data jal $t9 nop