nintendoswitch: Add env parser and removed unused stuff

*	Heap allocation based on available ram
*	Added homebrew launcher parser (for overriden heap)
*	Removed unused stuff (moved to gonx)
*	Kept require code at minimum to work in a real device
*	Moved everything to a single file
This commit is contained in:
Lucas Teske
2020-09-13 20:52:01 -03:00
committed by Ayke
parent d424b3d7ea
commit 387bca8e32
9 changed files with 300 additions and 122 deletions
+33 -38
View File
@@ -1,45 +1,40 @@
.section .text.armGetSystemTick, "ax", %progbits
.global armGetSystemTick
.type armGetSystemTick, %function
.align 2
armGetSystemTick:
// Macro for writing less code
.macro FUNC name
.section .text.\name, "ax", %progbits
.global \name
.type \name, %function
.align 2
\name:
.endm
FUNC armGetSystemTick
mrs x0, cntpct_el0
ret
.section .text.nxOutputString, "ax", %progbits
.global nxOutputString
.type nxOutputString, %function
.align 2
.cfi_startproc
nxOutputString:
svc 0x27
ret
.cfi_endproc
// Horizon System Calls
// https://switchbrew.org/wiki/SVC
FUNC svcSetHeapSize
str x0, [sp, #-16]!
svc 0x1
ldr x2, [sp], #16
str x1, [x2]
ret
.section .text.exit, "ax", %progbits
.global exit
.type exit, %function
.align 2
exit:
svc 0x7
ret
FUNC svcExitProcess
svc 0x7
ret
.section .text.setHeapSize, "ax", %progbits
.global setHeapSize
.type setHeapSize, %function
.align 2
setHeapSize:
str x0, [sp, #-16]!
svc 0x1
ldr x2, [sp], #16
str x1, [x2]
ret
FUNC svcSleepThread
svc 0xB
ret
FUNC svcOutputDebugString
svc 0x27
ret
.section .text.sleepThread, "ax", %progbits
.global sleepThread
.type sleepThread, %function
.align 2
sleepThread:
svc 0xB
ret
FUNC svcGetInfo
str x0, [sp, #-16]!
svc 0x29
ldr x2, [sp], #16
str x1, [x2]
ret