2003-02-18 23:55:36 +01:00
|
|
|
#ifndef GEMU_H
|
|
|
|
#define GEMU_H
|
|
|
|
|
|
|
|
#include "thunk.h"
|
|
|
|
|
2003-03-23 17:49:39 +01:00
|
|
|
#include <signal.h>
|
|
|
|
#include "syscall_defs.h"
|
2003-02-18 23:55:36 +01:00
|
|
|
|
2003-03-23 17:49:39 +01:00
|
|
|
#ifdef TARGET_I386
|
|
|
|
#include "cpu-i386.h"
|
|
|
|
#include "syscall-i386.h"
|
2003-03-23 02:06:05 +01:00
|
|
|
#endif
|
|
|
|
|
2003-02-18 23:55:36 +01:00
|
|
|
/* This struct is used to hold certain information about the image.
|
|
|
|
* Basically, it replicates in user space what would be certain
|
|
|
|
* task_struct fields in the kernel
|
|
|
|
*/
|
|
|
|
struct image_info {
|
|
|
|
unsigned long start_code;
|
|
|
|
unsigned long end_code;
|
|
|
|
unsigned long end_data;
|
|
|
|
unsigned long start_brk;
|
|
|
|
unsigned long brk;
|
|
|
|
unsigned long start_mmap;
|
|
|
|
unsigned long mmap;
|
|
|
|
unsigned long rss;
|
|
|
|
unsigned long start_stack;
|
|
|
|
unsigned long arg_start;
|
|
|
|
unsigned long arg_end;
|
|
|
|
unsigned long env_start;
|
|
|
|
unsigned long env_end;
|
|
|
|
unsigned long entry;
|
|
|
|
int personality;
|
|
|
|
};
|
|
|
|
|
2003-03-29 17:53:14 +01:00
|
|
|
/* Information about the current linux thread */
|
|
|
|
struct vm86_saved_state {
|
|
|
|
uint32_t eax; /* return code */
|
|
|
|
uint32_t ebx;
|
|
|
|
uint32_t ecx;
|
|
|
|
uint32_t edx;
|
|
|
|
uint32_t esi;
|
|
|
|
uint32_t edi;
|
|
|
|
uint32_t ebp;
|
|
|
|
uint32_t esp;
|
|
|
|
uint32_t eflags;
|
|
|
|
uint32_t eip;
|
|
|
|
uint16_t cs, ss, ds, es, fs, gs;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* NOTE: we force a big alignment so that the stack stored after is
|
|
|
|
aligned too */
|
|
|
|
typedef struct TaskState {
|
|
|
|
struct TaskState *next;
|
|
|
|
struct target_vm86plus_struct *target_v86;
|
|
|
|
struct vm86_saved_state vm86_saved_regs;
|
|
|
|
int used; /* non zero if used */
|
|
|
|
uint8_t stack[0];
|
|
|
|
} __attribute__((aligned(16))) TaskState;
|
|
|
|
|
|
|
|
extern TaskState *first_task_state;
|
|
|
|
|
2003-04-11 02:16:16 +02:00
|
|
|
int elf_exec(const char * filename, char ** argv, char ** envp,
|
2003-02-19 00:00:51 +01:00
|
|
|
struct target_pt_regs * regs, struct image_info *infop);
|
2003-02-18 23:55:36 +01:00
|
|
|
|
|
|
|
void target_set_brk(char *new_brk);
|
|
|
|
void syscall_init(void);
|
2003-03-16 19:05:05 +01:00
|
|
|
long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
|
2003-02-18 23:55:36 +01:00
|
|
|
long arg4, long arg5, long arg6);
|
|
|
|
void gemu_log(const char *fmt, ...) __attribute__((format(printf,1,2)));
|
2003-03-23 17:49:39 +01:00
|
|
|
extern CPUX86State *global_env;
|
|
|
|
void cpu_loop(CPUX86State *env);
|
2003-03-23 02:06:05 +01:00
|
|
|
void process_pending_signals(void *cpu_env);
|
|
|
|
void signal_init(void);
|
2003-03-23 17:49:39 +01:00
|
|
|
int queue_signal(int sig, target_siginfo_t *info);
|
2003-03-30 23:02:40 +02:00
|
|
|
void save_v86_state(CPUX86State *env);
|
2003-04-11 02:16:16 +02:00
|
|
|
void init_paths(const char *prefix);
|
|
|
|
const char *path(const char *pathname);
|
2003-04-29 22:39:23 +02:00
|
|
|
|
|
|
|
extern int loglevel;
|
2003-02-18 23:55:36 +01:00
|
|
|
#endif
|