]> git.proxmox.com Git - qemu.git/blame - linux-user/qemu.h
new directory structure
[qemu.git] / linux-user / qemu.h
CommitLineData
31e31b8a
FB
1#ifndef GEMU_H
2#define GEMU_H
3
4#include "thunk.h"
5
9de5e440
FB
6#include <signal.h>
7#include "syscall_defs.h"
31e31b8a 8
2054396a
FB
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
66fb9763 18
31e31b8a
FB
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 */
23struct 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
b346ff46 41#ifdef TARGET_I386
851e67a1
FB
42/* Information about the current linux thread */
43struct 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};
b346ff46 56#endif
851e67a1
FB
57
58/* NOTE: we force a big alignment so that the stack stored after is
59 aligned too */
60typedef struct TaskState {
61 struct TaskState *next;
b346ff46 62#ifdef TARGET_I386
851e67a1
FB
63 struct target_vm86plus_struct *target_v86;
64 struct vm86_saved_state vm86_saved_regs;
b333af06 65 struct target_vm86plus_struct vm86plus;
631271d7
FB
66 uint32_t v86flags;
67 uint32_t v86mask;
b346ff46 68#endif
851e67a1
FB
69 int used; /* non zero if used */
70 uint8_t stack[0];
71} __attribute__((aligned(16))) TaskState;
72
73extern TaskState *first_task_state;
74
32ce6337 75int elf_exec(const char * filename, char ** argv, char ** envp,
01ffc75b 76 struct target_pt_regs * regs, struct image_info *infop);
31e31b8a
FB
77
78void target_set_brk(char *new_brk);
79void syscall_init(void);
6dbad63e 80long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
31e31b8a
FB
81 long arg4, long arg5, long arg6);
82void gemu_log(const char *fmt, ...) __attribute__((format(printf,1,2)));
b346ff46
FB
83extern CPUState *global_env;
84void cpu_loop(CPUState *env);
32ce6337
FB
85void init_paths(const char *prefix);
86const char *path(const char *pathname);
6977fbfd
FB
87
88extern int loglevel;
631271d7
FB
89extern FILE *logfile;
90
b346ff46
FB
91/* signal.c */
92void process_pending_signals(void *cpu_env);
93void signal_init(void);
94int queue_signal(int sig, target_siginfo_t *info);
95void host_to_target_siginfo(target_siginfo_t *tinfo, const siginfo_t *info);
96void target_to_host_siginfo(siginfo_t *info, const target_siginfo_t *tinfo);
97long do_sigreturn(CPUState *env);
98long do_rt_sigreturn(CPUState *env);
99
100#ifdef TARGET_I386
631271d7
FB
101/* vm86.c */
102void save_v86_state(CPUX86State *env);
447db213 103void handle_vm86_trap(CPUX86State *env, int trapno);
631271d7
FB
104void handle_vm86_fault(CPUX86State *env);
105int do_vm86(CPUX86State *env, long subfunction,
106 struct target_vm86plus_struct * target_v86);
b346ff46 107#endif
631271d7 108
54936004
FB
109/* mmap.c */
110int target_mprotect(unsigned long start, unsigned long len, int prot);
111long target_mmap(unsigned long start, unsigned long len, int prot,
112 int flags, int fd, unsigned long offset);
113int target_munmap(unsigned long start, unsigned long len);
114long target_mremap(unsigned long old_addr, unsigned long old_size,
115 unsigned long new_size, unsigned long flags,
116 unsigned long new_addr);
117int target_msync(unsigned long start, unsigned long len, int flags);
118
31e31b8a 119#endif