xref: /haiku/src/system/boot/platform/riscv/entry.S (revision a182bd6eb5656b9fa14556fd0006bd514c6516fe)
1*a182bd6eSX512/*
2*a182bd6eSX512 * Copyright 2020-2021, Haiku, Inc. All rights reserved.
3*a182bd6eSX512 * Distributed under the terms of the MIT License.
4*a182bd6eSX512 */
5*a182bd6eSX512
6*a182bd6eSX512#include <asm_defs.h>
7*a182bd6eSX512
8*a182bd6eSX512    .text
9*a182bd6eSX512
10*a182bd6eSX512/*  status_t arch_enter_kernel(struct kernel_args* kernelArgs,
11*a182bd6eSX512        addr_t kernelEntry, addr_t kernelStackTop);
12*a182bd6eSX512
13*a182bd6eSX512    a0  - kernelArgs
14*a182bd6eSX512    a1  - kernelEntry
15*a182bd6eSX512    a2  - kernelStackTop
16*a182bd6eSX512*/
17*a182bd6eSX512FUNCTION(arch_enter_kernel):
18*a182bd6eSX512	// set the kernel stack
19*a182bd6eSX512	mv	sp,a2
20*a182bd6eSX512
21*a182bd6eSX512	// Setup kernel args
22*a182bd6eSX512	//mv	a0,a0	// kernelArgs
23*a182bd6eSX512	mv	a4,a1
24*a182bd6eSX512	li	a1,0	// currentCPU=0
25*a182bd6eSX512
26*a182bd6eSX512	// call the kernel
27*a182bd6eSX512	jr	a4
28*a182bd6eSX512
29*a182bd6eSX512	// return
30*a182bd6eSX512	li	a0,-1  // B_ERROR
31*a182bd6eSX512	ret
32*a182bd6eSX512FUNCTION_END(arch_enter_kernel)
33