root / linux-user / qemu.h @ 455b7619
History | View | Annotate | Download (2.1 kB)
1 | 31e31b8a | bellard | #ifndef GEMU_H
|
---|---|---|---|
2 | 31e31b8a | bellard | #define GEMU_H
|
3 | 31e31b8a | bellard | |
4 | 31e31b8a | bellard | #include "thunk.h" |
5 | 31e31b8a | bellard | |
6 | 9de5e440 | bellard | #include <signal.h> |
7 | 9de5e440 | bellard | #include "syscall_defs.h" |
8 | 31e31b8a | bellard | |
9 | 9de5e440 | bellard | #ifdef TARGET_I386
|
10 | 9de5e440 | bellard | #include "cpu-i386.h" |
11 | 9de5e440 | bellard | #include "syscall-i386.h" |
12 | 66fb9763 | bellard | #endif
|
13 | 66fb9763 | bellard | |
14 | 31e31b8a | bellard | /* This struct is used to hold certain information about the image.
|
15 | 31e31b8a | bellard | * Basically, it replicates in user space what would be certain
|
16 | 31e31b8a | bellard | * task_struct fields in the kernel
|
17 | 31e31b8a | bellard | */
|
18 | 31e31b8a | bellard | struct image_info {
|
19 | 31e31b8a | bellard | unsigned long start_code; |
20 | 31e31b8a | bellard | unsigned long end_code; |
21 | 31e31b8a | bellard | unsigned long end_data; |
22 | 31e31b8a | bellard | unsigned long start_brk; |
23 | 31e31b8a | bellard | unsigned long brk; |
24 | 31e31b8a | bellard | unsigned long start_mmap; |
25 | 31e31b8a | bellard | unsigned long mmap; |
26 | 31e31b8a | bellard | unsigned long rss; |
27 | 31e31b8a | bellard | unsigned long start_stack; |
28 | 31e31b8a | bellard | unsigned long arg_start; |
29 | 31e31b8a | bellard | unsigned long arg_end; |
30 | 31e31b8a | bellard | unsigned long env_start; |
31 | 31e31b8a | bellard | unsigned long env_end; |
32 | 31e31b8a | bellard | unsigned long entry; |
33 | 31e31b8a | bellard | int personality;
|
34 | 31e31b8a | bellard | }; |
35 | 31e31b8a | bellard | |
36 | 851e67a1 | bellard | /* Information about the current linux thread */
|
37 | 851e67a1 | bellard | struct vm86_saved_state {
|
38 | 851e67a1 | bellard | uint32_t eax; /* return code */
|
39 | 851e67a1 | bellard | uint32_t ebx; |
40 | 851e67a1 | bellard | uint32_t ecx; |
41 | 851e67a1 | bellard | uint32_t edx; |
42 | 851e67a1 | bellard | uint32_t esi; |
43 | 851e67a1 | bellard | uint32_t edi; |
44 | 851e67a1 | bellard | uint32_t ebp; |
45 | 851e67a1 | bellard | uint32_t esp; |
46 | 851e67a1 | bellard | uint32_t eflags; |
47 | 851e67a1 | bellard | uint32_t eip; |
48 | 851e67a1 | bellard | uint16_t cs, ss, ds, es, fs, gs; |
49 | 851e67a1 | bellard | }; |
50 | 851e67a1 | bellard | |
51 | 851e67a1 | bellard | /* NOTE: we force a big alignment so that the stack stored after is
|
52 | 851e67a1 | bellard | aligned too */
|
53 | 851e67a1 | bellard | typedef struct TaskState { |
54 | 851e67a1 | bellard | struct TaskState *next;
|
55 | 851e67a1 | bellard | struct target_vm86plus_struct *target_v86;
|
56 | 851e67a1 | bellard | struct vm86_saved_state vm86_saved_regs;
|
57 | 851e67a1 | bellard | int used; /* non zero if used */ |
58 | 851e67a1 | bellard | uint8_t stack[0];
|
59 | 851e67a1 | bellard | } __attribute__((aligned(16))) TaskState;
|
60 | 851e67a1 | bellard | |
61 | 851e67a1 | bellard | extern TaskState *first_task_state;
|
62 | 851e67a1 | bellard | |
63 | 32ce6337 | bellard | int elf_exec(const char * filename, char ** argv, char ** envp, |
64 | 01ffc75b | bellard | struct target_pt_regs * regs, struct image_info *infop); |
65 | 31e31b8a | bellard | |
66 | 31e31b8a | bellard | void target_set_brk(char *new_brk); |
67 | 31e31b8a | bellard | void syscall_init(void); |
68 | 6dbad63e | bellard | long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
69 | 31e31b8a | bellard | long arg4, long arg5, long arg6); |
70 | 31e31b8a | bellard | void gemu_log(const char *fmt, ...) __attribute__((format(printf,1,2))); |
71 | 9de5e440 | bellard | extern CPUX86State *global_env;
|
72 | 9de5e440 | bellard | void cpu_loop(CPUX86State *env);
|
73 | 66fb9763 | bellard | void process_pending_signals(void *cpu_env); |
74 | 66fb9763 | bellard | void signal_init(void); |
75 | 9de5e440 | bellard | int queue_signal(int sig, target_siginfo_t *info); |
76 | bc8a22cc | bellard | void save_v86_state(CPUX86State *env);
|
77 | 32ce6337 | bellard | void init_paths(const char *prefix); |
78 | 32ce6337 | bellard | const char *path(const char *pathname); |
79 | 6977fbfd | bellard | |
80 | 6977fbfd | bellard | extern int loglevel; |
81 | 31e31b8a | bellard | #endif |