1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2021 Cadence Design Systems Inc. */
3 
4 #ifndef _XTENSA_PLATFORM_ISS_SIMCALL_GDBIO_H
5 #define _XTENSA_PLATFORM_ISS_SIMCALL_GDBIO_H
6 
7 /*
8  *  System call like services offered by the GDBIO host.
9  */
10 
11 #define SYS_open	-2
12 #define SYS_close	-3
13 #define SYS_read	-4
14 #define SYS_write	-5
15 #define SYS_lseek	-6
16 
17 static int errno;
18 
__simc(int a,int b,int c,int d)19 static inline int __simc(int a, int b, int c, int d)
20 {
21 	register int a1 asm("a2") = a;
22 	register int b1 asm("a6") = b;
23 	register int c1 asm("a3") = c;
24 	register int d1 asm("a4") = d;
25 	__asm__ __volatile__ (
26 			"break 1, 14\n"
27 			: "+r"(a1), "+r"(c1)
28 			: "r"(b1), "r"(d1)
29 			: "memory");
30 	errno = c1;
31 	return a1;
32 }
33 
34 #endif /* _XTENSA_PLATFORM_ISS_SIMCALL_GDBIO_H */
35