1 /*
2  * Copyright (c) 2022, Commonwealth Scientific and Industrial Research
3  * Organisation (CSIRO) ABN 41 687 119 230.
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #include <zephyr/arch/common/semihost.h>
9 
semihost_exec(enum semihost_instr instr,void * args)10 long semihost_exec(enum semihost_instr instr, void *args)
11 {
12 	register unsigned long w0 __asm__ ("w0") = instr;
13 	register void *x1 __asm__ ("x1") = args;
14 	register long ret __asm__ ("x0");
15 
16 	__asm__ volatile ("hlt 0xf000"
17 			  : "=r" (ret) : "r" (w0), "r" (x1) : "memory");
18 	return ret;
19 }
20