diff options
| author | Derek Hensley <hensley.derek58@gmail.com> | 2024-09-03 17:19:13 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-03 19:19:13 -0400 |
| commit | 3e200769f125e2886829dd29a8d786db2406067e (patch) | |
| tree | bf4469bd23a1620ea6deab35445e9dfde8cb5405 /src/code/load.c | |
| parent | 2152d1df2d38f71f3693d73a764c981e54031924 (diff) | |
[ntsc-1.2] LoadFragment2 OK (#2118)
* [ntsc-1.2] LoadFragment2 OK
* Add insight about bssSize
Diffstat (limited to 'src/code/load.c')
| -rw-r--r-- | src/code/load.c | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/src/code/load.c b/src/code/load.c deleted file mode 100644 index 39662cbce..000000000 --- a/src/code/load.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "global.h" - -size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd, void* allocatedRamAddr) { - s32 pad[3]; - uintptr_t end; - OverlayRelocationSection* ovlRelocs; - u32 relocSectionOffset = 0; - s32 size = vromEnd - vromStart; - - if (gOverlayLogSeverity >= 3) { - PRINTF( - T("\nダイナミックリンクファンクションのロードを開始します\n", "\nStart loading dynamic link function\n")); - } - - size = vromEnd - vromStart; - end = (uintptr_t)allocatedRamAddr + size; - - if (gOverlayLogSeverity >= 3) { - PRINTF(T("TEXT,DATA,RODATA+relをDMA転送します(%08x-%08x)\n", - "DMA transfer of TEXT, DATA, RODATA + rel (%08x-%08x)\n"), - allocatedRamAddr, end); - } - - // DMA the overlay, wait until transfer completes - DmaMgr_RequestSync(allocatedRamAddr, vromStart, size); - - // The overlay file is expected to contain a 32-bit offset from the end of the file to the start of the - // relocation section. - relocSectionOffset = ((s32*)end)[-1]; - ovlRelocs = (OverlayRelocationSection*)(end - relocSectionOffset); - - if (gOverlayLogSeverity >= 3) { - PRINTF("TEXT(%08x), DATA(%08x), RODATA(%08x), BSS(%08x)\n", ovlRelocs->textSize, ovlRelocs->dataSize, - ovlRelocs->rodataSize, ovlRelocs->bssSize); - } - - if (gOverlayLogSeverity >= 3) { - PRINTF(T("リロケーションします\n", "Relocate\n")); - } - - // Relocate pointers in overlay code and data - Overlay_Relocate(allocatedRamAddr, ovlRelocs, vramStart); - - // Clear bss if present, bss is located immediately following the relocations - if (ovlRelocs->bssSize != 0) { - if (gOverlayLogSeverity >= 3) { - PRINTF(T("BSS領域をクリアします(%08x-%08x)\n", "Clear BSS area (%08x-%08x)\n"), end, - end + ovlRelocs->bssSize); - } - bzero((void*)end, ovlRelocs->bssSize); - } - - size = (uintptr_t)(ovlRelocs->relocations + ovlRelocs->nRelocations) - (uintptr_t)ovlRelocs; - - if (gOverlayLogSeverity >= 3) { - PRINTF(T("REL領域をクリアします(%08x-%08x)\n", "Clear REL area (%08x-%08x)\n"), ovlRelocs, - (uintptr_t)ovlRelocs + size); - } - - // Clear relocations, this space remains allocated and goes unused - bzero(ovlRelocs, size); - - // Manually flush caches - size = (uintptr_t)vramEnd - (uintptr_t)vramStart; - osWritebackDCache(allocatedRamAddr, size); - osInvalICache(allocatedRamAddr, size); - - if (gOverlayLogSeverity >= 3) { - PRINTF( - T("ダイナミックリンクファンクションのロードを終了します\n\n", "Finish loading dynamic link function\n\n")); - } - - return size; -} |
