mirror of
https://github.com/LNH-team/pico-loader.git
synced 2026-06-02 01:06:50 +02:00
Clear all arm9 cpu registers before jumping to the arm9 entry point. Fixes Cake Ninja DSiWare titles.
This commit is contained in:
5
arm9/source/jumpToArm9EntryPoint.h
Normal file
5
arm9/source/jumpToArm9EntryPoint.h
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
/// @brief Clears all cpu registers and jumps to the specified \p arm9EntryPoint.
|
||||||
|
/// @param arm9EntryPoint The arm9 entry point to jump to.
|
||||||
|
extern "C" void jumpToArm9EntryPoint(void* arm9EntryPoint);
|
||||||
29
arm9/source/jumpToArm9EntryPoint.s
Normal file
29
arm9/source/jumpToArm9EntryPoint.s
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
.section ".itcm", "ax"
|
||||||
|
.arm
|
||||||
|
|
||||||
|
// r0: arm9EntryPoint
|
||||||
|
.global jumpToArm9EntryPoint
|
||||||
|
.type jumpToArm9EntryPoint, %function
|
||||||
|
jumpToArm9EntryPoint:
|
||||||
|
str r0, entry_point
|
||||||
|
// Clear all registers
|
||||||
|
mov r0, #0
|
||||||
|
mov r1, #0
|
||||||
|
mov r2, #0
|
||||||
|
mov r3, #0
|
||||||
|
mov r4, #0
|
||||||
|
mov r5, #0
|
||||||
|
mov r6, #0
|
||||||
|
mov r7, #0
|
||||||
|
mov r8, #0
|
||||||
|
mov r9, #0
|
||||||
|
mov r10, #0
|
||||||
|
mov r11, #0
|
||||||
|
mov r12, #0
|
||||||
|
mov sp, #0
|
||||||
|
mov lr, #0
|
||||||
|
// Jump to the arm9 entry point
|
||||||
|
ldr pc, entry_point
|
||||||
|
|
||||||
|
entry_point:
|
||||||
|
.word 0
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "arm9Clock.h"
|
#include "arm9Clock.h"
|
||||||
#include "errorDisplay/ErrorDisplay.h"
|
#include "errorDisplay/ErrorDisplay.h"
|
||||||
#include "LoaderInfo.h"
|
#include "LoaderInfo.h"
|
||||||
|
#include "jumpToArm9EntryPoint.h"
|
||||||
|
|
||||||
typedef void (*entrypoint_t)(void);
|
typedef void (*entrypoint_t)(void);
|
||||||
|
|
||||||
@@ -109,7 +110,7 @@ static void bootArm9()
|
|||||||
while (gfx_getVCount() == 191);
|
while (gfx_getVCount() == 191);
|
||||||
REG_IF = ~0u; // final clear of REG_IF bits
|
REG_IF = ~0u; // final clear of REG_IF bits
|
||||||
auto romHeader = (const nds_header_ntr_t*)TWL_SHARED_MEMORY->ntrSharedMem.romHeader;
|
auto romHeader = (const nds_header_ntr_t*)TWL_SHARED_MEMORY->ntrSharedMem.romHeader;
|
||||||
((entrypoint_t)romHeader->arm9EntryAddress)();
|
jumpToArm9EntryPoint((void*)romHeader->arm9EntryAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handleInitializeSdCardCommand()
|
static void handleInitializeSdCardCommand()
|
||||||
|
|||||||
Reference in New Issue
Block a user