d0k3 / GodMode9

GodMode9 Explorer - A full access file browser for the Nintendo 3DS console :godmode:
GNU General Public License v3.0
2.07k stars 192 forks source link

[BUG] AHBWRAM section can overflow into hardcoded BootROM copy space #826

Closed danny8376 closed 10 months ago

danny8376 commented 10 months ago

Main issue is there's b9s bootrom dump which we can't move so AHBWRAM should actually be shrunken to 488K to avoid overlapping with boot9 bootrom dump (0x08080000 - 0x08006000 = 488K) Since we only have 488K, minus 377K (arm9.bin of v2.1.1), we actually only have 111K available, which is less than half of what we have previously (223.5K)

And do we actually have anything located at 0x080A0000 ~ 0x080C0000? if not, we should be able to shift old vram0 to 0x080A0000 and enlarge it to 351.5K, or we can simply ignore bootrom dump and enlarge AHBWRAM directly?

luigoalma commented 10 months ago

This was originally noted whilst talking to @ihaveamac about the lua scripting testing fork, we originally raised of the AHBWRAM to LENGTH to 744k. We did not realize at the time that boot9.bin was no longer accessible in Virtual Memory earlier as GM9 test branch grew a bigger code size with the lua code. GodMode9's latest commit, 031762a as of this writing, does not surpass the limit and overlap the boot9 address yet, if no extra files are added to vram. As @danny8376 writes out, we only have 488K. The LENGTH of AHBWRAM in link.ld should be changed to 488K, max size starting at 0x8006000 until boot9 address dump.

Wolfvak commented 10 months ago

Thanks for the report! It's a pity the bootrom copies are so low in ARM9 memory but I think keeping this section's size down to 488K is reasonable, and we prefer to keep the total FIRM size below 512K anyways due to flash limits in some ntrboot carts.

@danny8376 I'm tihnking about removing the vram0.tar size limit specified in the Makefile - since it's now linked in the main binary, if you were to exceed the size you'd get a link time error about the sections not being able to fit in memory. Do you rely on the limit somewhere else, or do you think it's good enough for your purposes?

danny8376 commented 10 months ago

not really, at least not with this new commit i'm actually still using the old separate section method as that's what i've already done, and now with this bootrom issue, i'll keep with it as it's required i also agree with removing the limit as it's indeed redundant and not really necessary