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