2 * include/asm-xtensa/platform-iss/simcall.h
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
8 * Copyright (C) 2001 Tensilica Inc.
11 #ifndef _XTENSA_PLATFORM_ISS_SIMCALL_H
12 #define _XTENSA_PLATFORM_ISS_SIMCALL_H
16 * System call like services offered by the simulator host.
19 #define SYS_nop 0 /* unused */
20 #define SYS_exit 1 /*x*/
22 #define SYS_read 3 /*x*/
23 #define SYS_write 4 /*x*/
24 #define SYS_open 5 /*x*/
25 #define SYS_close 6 /*x*/
26 #define SYS_rename 7 /*x 38 - waitpid */
27 #define SYS_creat 8 /*x*/
28 #define SYS_link 9 /*x (not implemented on WIN32) */
29 #define SYS_unlink 10 /*x*/
30 #define SYS_execv 11 /* n/a - execve */
31 #define SYS_execve 12 /* 11 - chdir */
32 #define SYS_pipe 13 /* 42 - time */
33 #define SYS_stat 14 /* 106 - mknod */
35 #define SYS_chown 16 /* 202 - lchown */
36 #define SYS_utime 17 /* 30 - break */
37 #define SYS_wait 18 /* n/a - oldstat */
38 #define SYS_lseek 19 /*x*/
40 #define SYS_isatty 21 /* n/a - mount */
41 #define SYS_fstat 22 /* 108 - oldumount */
42 #define SYS_time 23 /* 13 - setuid */
43 #define SYS_gettimeofday 24 /*x 78 - getuid (not implemented on WIN32) */
44 #define SYS_times 25 /*X 43 - stime (Xtensa-specific implementation) */
47 #define SYS_recvfrom 28
48 #define SYS_select_one 29 /* not compitible select, one file descriptor at the time */
53 * SYS_select_one specifiers
56 #define XTISS_SELECT_ONE_READ 1
57 #define XTISS_SELECT_ONE_WRITE 2
58 #define XTISS_SELECT_ONE_EXCEPT 3
62 static inline int __simc(int a
, int b
, int c
, int d
, int e
, int f
)
65 register int a1
asm("a2") = a
;
66 register int b1
asm("a3") = b
;
67 register int c1
asm("a4") = c
;
68 register int d1
asm("a5") = d
;
69 register int e1
asm("a6") = e
;
70 register int f1
asm("a7") = f
;
71 __asm__
__volatile__ (
75 : "=a" (ret
), "=a" (errno
), "+r"(a1
), "+r"(b1
)
76 : "r"(c1
), "r"(d1
), "r"(e1
), "r"(f1
)
81 static inline int simc_open(char *file
, int flags
, int mode
)
83 return __simc(SYS_open
, (int) file
, flags
, mode
, 0, 0);
86 static inline int simc_close(int fd
)
88 return __simc(SYS_close
, fd
, 0, 0, 0, 0);
91 static inline int simc_ioctl(int fd
, int request
, void *arg
)
93 return __simc(SYS_ioctl
, fd
, request
, (int) arg
, 0, 0);
96 static inline int simc_read(int fd
, void *buf
, size_t count
)
98 return __simc(SYS_read
, fd
, (int) buf
, count
, 0, 0);
101 static inline int simc_write(int fd
, void *buf
, size_t count
)
103 return __simc(SYS_write
, fd
, (int) buf
, count
, 0, 0);
106 static inline int simc_poll(int fd
)
108 struct timeval tv
= { .tv_sec
= 0, .tv_usec
= 0 };
110 return __simc(SYS_select_one
, fd
, XTISS_SELECT_ONE_READ
, (int)&tv
,
114 #endif /* _XTENSA_PLATFORM_ISS_SIMCALL_H */
This page took 0.06619 seconds and 5 git commands to generate.