summaryrefslogblamecommitdiff
path: root/zap/source/arm64/sys/syscall.s
blob: df4817d943ea934af46873f5b32a36f5eee2aaf6 (plain) (tree)

























                                                                                                                
// Copyright 2022-2023 Gabriel Jensen.
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
// If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.

.globl zap_syscall

zap_syscall:
	// System calls on ARM64 use the following registers:
	// x0 : System call identifier
	// x1 : First parameter
	// x2 : Second parameter
	// x3 : Third parameter
	// x4 : Fourth parameter
	// x5 : Fifth parameter
	// x6 : Sixth parameter
	// x0 : Return value
	mov x8,x0 // Move the first parameter (the identifier) to x8.
	mov x0,x1 // Shift all of the other parameters to the left.
	mov x1,x2
	mov x2,x3
	mov x3,x4
	mov x4,x5
	mov x5,x6
	svc 0x0 // Zephyr
	// No need to move the return value (already in x0).
	ret