root / linux-user / qemu.h @ facc68be
History | View | Annotate | Download (3.3 kB)
1 |
#ifndef GEMU_H
|
---|---|
2 |
#define GEMU_H
|
3 |
|
4 |
#include "thunk.h" |
5 |
|
6 |
#include <signal.h> |
7 |
#include "syscall_defs.h" |
8 |
|
9 |
#if defined(TARGET_I386)
|
10 |
#include "cpu-i386.h" |
11 |
#include "syscall-i386.h" |
12 |
#elif defined(TARGET_ARM)
|
13 |
#include "cpu-arm.h" |
14 |
#include "syscall-arm.h" |
15 |
#else
|
16 |
#error unsupported target CPU
|
17 |
#endif
|
18 |
|
19 |
/* This struct is used to hold certain information about the image.
|
20 |
* Basically, it replicates in user space what would be certain
|
21 |
* task_struct fields in the kernel
|
22 |
*/
|
23 |
struct image_info {
|
24 |
unsigned long start_code; |
25 |
unsigned long end_code; |
26 |
unsigned long end_data; |
27 |
unsigned long start_brk; |
28 |
unsigned long brk; |
29 |
unsigned long start_mmap; |
30 |
unsigned long mmap; |
31 |
unsigned long rss; |
32 |
unsigned long start_stack; |
33 |
unsigned long arg_start; |
34 |
unsigned long arg_end; |
35 |
unsigned long env_start; |
36 |
unsigned long env_end; |
37 |
unsigned long entry; |
38 |
int personality;
|
39 |
}; |
40 |
|
41 |
#ifdef TARGET_I386
|
42 |
/* Information about the current linux thread */
|
43 |
struct vm86_saved_state {
|
44 |
uint32_t eax; /* return code */
|
45 |
uint32_t ebx; |
46 |
uint32_t ecx; |
47 |
uint32_t edx; |
48 |
uint32_t esi; |
49 |
uint32_t edi; |
50 |
uint32_t ebp; |
51 |
uint32_t esp; |
52 |
uint32_t eflags; |
53 |
uint32_t eip; |
54 |
uint16_t cs, ss, ds, es, fs, gs; |
55 |
}; |
56 |
#endif
|
57 |
|
58 |
/* NOTE: we force a big alignment so that the stack stored after is
|
59 |
aligned too */
|
60 |
typedef struct TaskState { |
61 |
struct TaskState *next;
|
62 |
#ifdef TARGET_I386
|
63 |
struct target_vm86plus_struct *target_v86;
|
64 |
struct vm86_saved_state vm86_saved_regs;
|
65 |
struct target_vm86plus_struct vm86plus;
|
66 |
uint32_t v86flags; |
67 |
uint32_t v86mask; |
68 |
#endif
|
69 |
int used; /* non zero if used */ |
70 |
uint8_t stack[0];
|
71 |
} __attribute__((aligned(16))) TaskState;
|
72 |
|
73 |
extern TaskState *first_task_state;
|
74 |
|
75 |
int elf_exec(const char * filename, char ** argv, char ** envp, |
76 |
struct target_pt_regs * regs, struct image_info *infop); |
77 |
|
78 |
void target_set_brk(char *new_brk); |
79 |
void syscall_init(void); |
80 |
long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
81 |
long arg4, long arg5, long arg6); |
82 |
void gemu_log(const char *fmt, ...) __attribute__((format(printf,1,2))); |
83 |
extern CPUState *global_env;
|
84 |
void cpu_loop(CPUState *env);
|
85 |
void init_paths(const char *prefix); |
86 |
const char *path(const char *pathname); |
87 |
|
88 |
extern int loglevel; |
89 |
extern FILE *logfile;
|
90 |
|
91 |
/* signal.c */
|
92 |
void process_pending_signals(void *cpu_env); |
93 |
void signal_init(void); |
94 |
int queue_signal(int sig, target_siginfo_t *info); |
95 |
void host_to_target_siginfo(target_siginfo_t *tinfo, const siginfo_t *info); |
96 |
void target_to_host_siginfo(siginfo_t *info, const target_siginfo_t *tinfo); |
97 |
long do_sigreturn(CPUState *env);
|
98 |
long do_rt_sigreturn(CPUState *env);
|
99 |
|
100 |
#ifdef TARGET_I386
|
101 |
/* vm86.c */
|
102 |
void save_v86_state(CPUX86State *env);
|
103 |
void handle_vm86_trap(CPUX86State *env, int trapno); |
104 |
void handle_vm86_fault(CPUX86State *env);
|
105 |
int do_vm86(CPUX86State *env, long subfunction, |
106 |
struct target_vm86plus_struct * target_v86);
|
107 |
#endif
|
108 |
|
109 |
/* mmap.c */
|
110 |
int target_mprotect(unsigned long start, unsigned long len, int prot); |
111 |
long target_mmap(unsigned long start, unsigned long len, int prot, |
112 |
int flags, int fd, unsigned long offset); |
113 |
int target_munmap(unsigned long start, unsigned long len); |
114 |
long target_mremap(unsigned long old_addr, unsigned long old_size, |
115 |
unsigned long new_size, unsigned long flags, |
116 |
unsigned long new_addr); |
117 |
int target_msync(unsigned long start, unsigned long len, int flags); |
118 |
|
119 |
#endif
|