diff options
author | Treeki <treeki@gmail.com> | 2011-07-11 00:43:12 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-07-11 00:43:12 +0200 |
commit | 17d678731d5c549c4dfdecc1991ae0d3df4389b5 (patch) | |
tree | 8f8e17269cdc2b6820970351898b692f31b80828 | |
parent | 64867e6578cca37971fd0cf08344a3e39e654bc2 (diff) | |
download | kamek-17d678731d5c549c4dfdecc1991ae0d3df4389b5.tar.gz kamek-17d678731d5c549c4dfdecc1991ae0d3df4389b5.zip |
fixed a bug with the C++ init code
-rw-r--r-- | kamek_ntsc.x | 1 | ||||
-rw-r--r-- | kamek_ntsc2.x | 1 | ||||
-rw-r--r-- | kamek_pal.x | 1 | ||||
-rw-r--r-- | kamek_pal2.x | 1 | ||||
-rw-r--r-- | src/prolog.S | 26 |
5 files changed, 20 insertions, 10 deletions
diff --git a/kamek_ntsc.x b/kamek_ntsc.x index 7aa6dbe..a9b3892 100644 --- a/kamek_ntsc.x +++ b/kamek_ntsc.x @@ -1021,6 +1021,7 @@ SECTIONS { *(.text) __ctor_loc = . ; *(.ctors) + __ctor_end = . ; *(.dtors) *(.rodata) /**(.sdata)*/ diff --git a/kamek_ntsc2.x b/kamek_ntsc2.x index ebb5b3e..1636599 100644 --- a/kamek_ntsc2.x +++ b/kamek_ntsc2.x @@ -1021,6 +1021,7 @@ SECTIONS { *(.text) __ctor_loc = . ; *(.ctors) + __ctor_end = . ; *(.dtors) *(.rodata) /**(.sdata)*/ diff --git a/kamek_pal.x b/kamek_pal.x index a8fb7ca..987ee45 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -1021,6 +1021,7 @@ SECTIONS { *(.text)
__ctor_loc = . ;
*(.ctors)
+ __ctor_end = . ;
*(.dtors)
*(.rodata)
/**(.sdata)*/
diff --git a/kamek_pal2.x b/kamek_pal2.x index eae29ae..0b8eb17 100644 --- a/kamek_pal2.x +++ b/kamek_pal2.x @@ -1021,6 +1021,7 @@ SECTIONS { *(.text) __ctor_loc = . ; *(.ctors) + __ctor_end = . ; *(.dtors) *(.rodata) /**(.sdata)*/ diff --git a/src/prolog.S b/src/prolog.S index 1a988ec..d942327 100644 --- a/src/prolog.S +++ b/src/prolog.S @@ -3,25 +3,30 @@ .set sp, 1 .extern __ctor_loc +.extern __ctor_end .extern OSReport .global Prolog Prolog: - stwu sp, -0x10(sp) + stwu sp, -0x20(sp) mflr r0 - stw r0, 0x14(sp) - stw r31, 0xC(sp) - stw r30, 0x8(sp) + stw r0, 0x24(sp) + stw r31, 0x1C(sp) + stw r30, 0x18(sp) + stw r29, 0x14(sp) # -- Go! li r30, 0 lis r31, __ctor_loc@h ori r31, r31, __ctor_loc@l + lis r29, __ctor_end@h + ori r29, r29, __ctor_end@l lis r3, PMsg@h ori r3, r3, PMsg@l mr r4, r31 + mr r5, r29 crclr 4*cr1+eq bl OSReport @@ -34,7 +39,7 @@ loop: addi r30, r30, 1 startLoop: lwz r12, 0(r31) - cmpwi r12, 0 + cmpw r31, r29 bne loop lis r3, PMsg2@h @@ -45,17 +50,18 @@ startLoop: # -- Done li r3, 1 - lwz r31, 0xC(sp) - lwz r30, 0x8(sp) - lwz r0, 0x14(sp) + lwz r31, 0x1C(sp) + lwz r30, 0x18(sp) + lwz r29, 0x14(sp) + lwz r0, 0x24(sp) mtlr r0 - addi sp, sp, 0x10 + addi sp, sp, 0x20 blr .data PMsg: - .string "Newer Super Mario Bros. Wii - Hacks by Treeki 2009-2011\n.ctors: %p\n" + .string "Newer Super Mario Bros. Wii - Hacks by Treeki 2009-2011\n.ctors: %p - %p\n" PMsg2: .string "%d inits called\n" |