1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#ifndef LINUX_USER_USER_INTERNALS_H
19#define LINUX_USER_USER_INTERNALS_H
20
21#include "exec/user/thunk.h"
22#include "exec/exec-all.h"
23#include "exec/tb-flush.h"
24#include "qemu/log.h"
25
26extern char *exec_path;
27void init_task_state(TaskState *ts);
28void task_settid(TaskState *);
29void stop_all_tasks(void);
30extern const char *qemu_uname_release;
31extern unsigned long mmap_min_addr;
32
33typedef struct IOCTLEntry IOCTLEntry;
34
35typedef abi_long do_ioctl_fn(const IOCTLEntry *ie, uint8_t *buf_temp,
36 int fd, int cmd, abi_long arg);
37
38struct IOCTLEntry {
39 int target_cmd;
40 unsigned int host_cmd;
41 const char *name;
42 int access;
43 do_ioctl_fn *do_ioctl;
44 const argtype arg_type[5];
45};
46
47extern IOCTLEntry ioctl_entries[];
48
49#define IOC_R 0x0001
50#define IOC_W 0x0002
51#define IOC_RW (IOC_R | IOC_W)
52
53
54
55
56
57
58
59int info_is_fdpic(struct image_info *info);
60
61void target_set_brk(abi_ulong new_brk);
62void syscall_init(void);
63abi_long do_syscall(CPUArchState *cpu_env, int num, abi_long arg1,
64 abi_long arg2, abi_long arg3, abi_long arg4,
65 abi_long arg5, abi_long arg6, abi_long arg7,
66 abi_long arg8);
67extern __thread CPUState *thread_cpu;
68G_NORETURN void cpu_loop(CPUArchState *env);
69abi_long get_errno(abi_long ret);
70const char *target_strerror(int err);
71int get_osversion(void);
72void init_qemu_uname_release(void);
73void fork_start(void);
74void fork_end(int child);
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95void probe_guest_base(const char *image_name,
96 abi_ulong loaddr, abi_ulong hiaddr);
97
98
99int host_to_target_waitstatus(int status);
100
101#ifdef TARGET_I386
102
103void save_v86_state(CPUX86State *env);
104void handle_vm86_trap(CPUX86State *env, int trapno);
105void handle_vm86_fault(CPUX86State *env);
106int do_vm86(CPUX86State *env, long subfunction, abi_ulong v86_addr);
107#elif defined(TARGET_SPARC64)
108void sparc64_set_context(CPUSPARCState *env);
109void sparc64_get_context(CPUSPARCState *env);
110#endif
111
112static inline int is_error(abi_long ret)
113{
114 return (abi_ulong)ret >= (abi_ulong)(-4096);
115}
116
117#if (TARGET_ABI_BITS == 32) && !defined(TARGET_ABI_MIPSN32)
118static inline uint64_t target_offset64(uint32_t word0, uint32_t word1)
119{
120#if TARGET_BIG_ENDIAN
121 return ((uint64_t)word0 << 32) | word1;
122#else
123 return ((uint64_t)word1 << 32) | word0;
124#endif
125}
126#else
127static inline uint64_t target_offset64(uint64_t word0, uint64_t word1)
128{
129 return word0;
130}
131#endif
132
133void print_termios(void *arg);
134
135
136#ifdef TARGET_ARM
137static inline int regpairs_aligned(CPUArchState *cpu_env, int num)
138{
139 return cpu_env->eabi;
140}
141#elif defined(TARGET_MIPS) && defined(TARGET_ABI_MIPSO32)
142static inline int regpairs_aligned(CPUArchState *cpu_env, int num) { return 1; }
143#elif defined(TARGET_PPC) && !defined(TARGET_PPC64)
144
145
146
147
148
149static inline int regpairs_aligned(CPUArchState *cpu_env, int num) { return 1; }
150#elif defined(TARGET_SH4)
151
152static inline int regpairs_aligned(CPUArchState *cpu_env, int num)
153{
154 switch (num) {
155 case TARGET_NR_pread64:
156 case TARGET_NR_pwrite64:
157 return 1;
158
159 default:
160 return 0;
161 }
162}
163#elif defined(TARGET_XTENSA)
164static inline int regpairs_aligned(CPUArchState *cpu_env, int num) { return 1; }
165#elif defined(TARGET_HEXAGON)
166static inline int regpairs_aligned(CPUArchState *cpu_env, int num) { return 1; }
167#else
168static inline int regpairs_aligned(CPUArchState *cpu_env, int num) { return 0; }
169#endif
170
171
172
173
174
175
176
177void preexit_cleanup(CPUArchState *env, int code);
178
179
180
181
182
183
184#include "target_cpu.h"
185#include "target_structs.h"
186
187#endif
188