jasondellaluce / arm9loaderhax

ARM9 Pre-Kernel Code Execution - Nintendo 3DS
GNU General Public License v2.0
104 stars 52 forks source link

Makes both stage1 and 2 as position independent executables #32

Closed gemarcano closed 8 years ago

gemarcano commented 8 years ago

These commits implement stage1 and 2 as position independent executables, meaning they can be placed at any address, and they should still run. Stage2 doesn't benefit from this too much (although this does mean it can easily be moved around now), but stage1 can now be moved without having to modify linker scripts if for some reason the key needs to change.

I have tested these changes on my o3DS. I tested stage1 relocation by changing the key being used to the old one and placing stage1 in the right place, but leaving everything else intact, which worked. It also works with the newer key. Stage2 I tested by simply changing the location in RAM where it was saved to and launched from. This also worked.

I would highly recommend this be tested by people with hardmods before being merged. I am not extremely confident in my understanding of PIC/PIE.

I also took the opportunity to try to improve the _start.s file in stage1, and the Makefiles.

pixel-stuck commented 8 years ago

Tested on my console, werks

mariogamer2 commented 8 years ago

In this case,what does "werk" mean?

LunaDook commented 8 years ago

@mariogamer2 Assume it was a grammatical error. He's saying it works on his device.

mariogamer2 commented 8 years ago

Can anyone test this with dark-samus/AuroraWright fork? (don't want to take the risk....)

jasondellaluce commented 8 years ago

I tested this in my Old3DS, and it worked with no problems. I'll wait some more confirmations, but i think that this pull request is legit.

sykhro commented 8 years ago

works on my end (new3ds)