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 int r0 __asm__ ("r0") = instr;
13 	register void *r1 __asm__ ("r1") = args;
14 	register int ret __asm__ ("r0");
15 
16 	__asm__ __volatile__ ("bkpt 0xab"
17 			      : "=r" (ret) : "r" (r0), "r" (r1) : "memory");
18 	return ret;
19 }
20