aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/runtime/runtime_nintendoswitch.S
blob: a4cac23e21d8c050f20b0e20f53667e48fa68244 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// 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

// Horizon System Calls
// https://switchbrew.org/wiki/SVC
FUNC svcSetHeapSize
    str x0, [sp, #-16]!
    svc 0x1
    ldr x2, [sp], #16
    str x1, [x2]
    ret

FUNC svcExitProcess
    svc 0x7
    ret

FUNC svcSleepThread
    svc 0xB
    ret

FUNC svcOutputDebugString
    svc 0x27
    ret

FUNC svcGetInfo
    str x0, [sp, #-16]!
    svc 0x29
    ldr x2, [sp], #16
    str x1, [x2]
    ret