mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-10 06:01:52 +00:00
Fix start.s in stage2 of Fusee for argc/argv
This commit is contained in:
parent
353019a269
commit
c758b1188a
3 changed files with 27 additions and 9 deletions
|
@ -2,8 +2,12 @@
|
|||
#include "hwinit.h"
|
||||
#include "loader.h"
|
||||
|
||||
#include "stage2.h"
|
||||
|
||||
int main(void) {
|
||||
/* Allow for main(int argc, void **argv) signature. */
|
||||
#pragma GCC diagnostic ignored "-Wmain"
|
||||
|
||||
int main(int argc, void **argv) {
|
||||
entrypoint_t entrypoint;
|
||||
|
||||
/* TODO: What other hardware init should we do here? */
|
||||
|
|
12
fusee/fusee-secondary/src/stage2.h
Normal file
12
fusee/fusee-secondary/src/stage2.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#ifndef FUSEE_STAGE2_H
|
||||
#define FUSEE_STAGE2_H
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
/* TODO: Is there a more concise way to do this? */
|
||||
#define STAGE2_ARGV_VERSION 0
|
||||
#define STAGE2_ARGV_CONFIG 1
|
||||
#define STAGE2_ARGV_LFB 2
|
||||
#define STAGE2_ARGC 3
|
||||
|
||||
#endif
|
|
@ -15,17 +15,17 @@ _start:
|
|||
msr cpsr_cxsf, #0xDF
|
||||
|
||||
/* Relocate ourselves if necessary */
|
||||
ldr r0, =__start__
|
||||
adr r1, _start
|
||||
cmp r0, r1
|
||||
ldr r2, =__start__
|
||||
adr r3, _start
|
||||
cmp r2, r3
|
||||
bne _relocation_loop_end
|
||||
|
||||
ldr r2, =__bss_start__
|
||||
sub r2, r2, r0 /* size >= 32, obviously */
|
||||
ldr r4, =__bss_start__
|
||||
sub r4, r4, r2 /* size >= 32, obviously */
|
||||
_relocation_loop:
|
||||
ldmia r1!, {r3-r10}
|
||||
stmia r0!, {r3-r10}
|
||||
subs r2, #0x20
|
||||
ldmia r3!, {r5-r12}
|
||||
stmia r2!, {r5-r12}
|
||||
subs r4, #0x20
|
||||
bne _relocation_loop
|
||||
|
||||
ldr r12, =_relocation_loop_end
|
||||
|
@ -35,6 +35,7 @@ _start:
|
|||
/* Set the stack pointer */
|
||||
ldr sp, =0x40008000
|
||||
mov fp, #0
|
||||
stmfd sp!, {r0, r1}
|
||||
|
||||
/* Clear .bss */
|
||||
ldr r0, =__bss_start__
|
||||
|
@ -50,5 +51,6 @@ _start:
|
|||
.rept 13
|
||||
CLEAR_GPR_REG_ITER
|
||||
.endr
|
||||
ldmfd sp!, {r0, r1}
|
||||
bl main
|
||||
b .
|
||||
|
|
Loading…
Reference in a new issue