13 typedef siginfo_t target_siginfo_t
;
14 #define target_sigaction sigaction
16 struct target_pt_regs
{
33 struct target_sigcontext
{
54 #define __USER_CS (0x17)
55 #define __USER_DS (0x1F)
57 #elif defined(TARGET_PPC)
58 struct target_pt_regs
{
59 unsigned long gpr
[32];
62 unsigned long orig_gpr3
; /* Used for restarting system calls */
67 unsigned long mq
; /* 601 only (not used at present) */
68 /* Used on APUS to hold IPL value. */
69 unsigned long trap
; /* Reason for being here */
70 unsigned long dar
; /* Fault registers */
72 unsigned long result
; /* Result of a system call */
75 struct target_sigcontext
{
76 int sc_onstack
; /* sigstack state to restore */
77 int sc_mask
; /* signal mask to restore */
79 int sc_psw
; /* processor status word */
80 int sc_sp
; /* stack pointer if sc_regs == NULL */
81 void *sc_regs
; /* (kernel private) saved state */
86 typedef struct TaskState
{
87 struct TaskState
*next
;
88 int used
; /* non zero if used */
90 } __attribute__((aligned(16))) TaskState
;
92 void syscall_init(void);
93 long do_mach_syscall(void *cpu_env
, int num
, uint32_t arg1
, uint32_t arg2
, uint32_t arg3
,
94 uint32_t arg4
, uint32_t arg5
, uint32_t arg6
, uint32_t arg7
, uint32_t arg8
);
95 long do_thread_syscall(void *cpu_env
, int num
, uint32_t arg1
, uint32_t arg2
, uint32_t arg3
,
96 uint32_t arg4
, uint32_t arg5
, uint32_t arg6
, uint32_t arg7
, uint32_t arg8
);
97 long do_unix_syscall(void *cpu_env
, int num
);
98 int do_sigaction(int sig
, const struct sigaction
*act
,
99 struct sigaction
*oact
);
100 int do_sigaltstack(const struct sigaltstack
*ss
, struct sigaltstack
*oss
);
102 void gemu_log(const char *fmt
, ...) __attribute__((format(printf
,1,2)));
103 void qerror(const char *fmt
, ...);
105 void write_dt(void *ptr
, unsigned long addr
, unsigned long limit
, int flags
);
107 extern CPUState
*global_env
;
108 void cpu_loop(CPUState
*env
);
109 void init_paths(const char *prefix
);
110 const char *path(const char *pathname
);
112 #include "qemu-log.h"
115 void commpage_init(void);
116 void do_commpage(void *cpu_env
, int num
, uint32_t arg1
, uint32_t arg2
, uint32_t arg3
,
117 uint32_t arg4
, uint32_t arg5
, uint32_t arg6
, uint32_t arg7
, uint32_t arg8
);
120 void process_pending_signals(void *cpu_env
);
121 void signal_init(void);
122 int queue_signal(int sig
, target_siginfo_t
*info
);
123 void host_to_target_siginfo(target_siginfo_t
*tinfo
, const siginfo_t
*info
);
124 void target_to_host_siginfo(siginfo_t
*info
, const target_siginfo_t
*tinfo
);
125 long do_sigreturn(CPUState
*env
, int num
);
128 int mach_exec(const char * filename
, char ** argv
, char ** envp
,
129 struct target_pt_regs
* regs
);
132 int target_mprotect(unsigned long start
, unsigned long len
, int prot
);
133 long target_mmap(unsigned long start
, unsigned long len
, int prot
,
134 int flags
, int fd
, unsigned long offset
);
135 int target_munmap(unsigned long start
, unsigned long len
);
136 long target_mremap(unsigned long old_addr
, unsigned long old_size
,
137 unsigned long new_size
, unsigned long flags
,
138 unsigned long new_addr
);
139 int target_msync(unsigned long start
, unsigned long len
, int flags
);
143 /* XXX: todo protect every memory access */
144 #define lock_user(x,y,z) (void*)(x)
145 #define unlock_user(x,y,z)
147 /* Mac OS X ABI arguments processing */
149 static inline uint32_t get_int_arg(int *i
, CPUX86State
*cpu_env
)
151 uint32_t *args
= (uint32_t*)(cpu_env
->regs
[R_ESP
] + 4 + *i
);
153 return tswap32(*args
);
155 static inline uint64_t get_int64_arg(int *i
, CPUX86State
*cpu_env
)
157 uint64_t *args
= (uint64_t*)(cpu_env
->regs
[R_ESP
] + 4 + *i
);
159 return tswap64(*args
);
161 #elif defined(TARGET_PPC)
162 static inline uint32_t get_int_arg(int *i
, CPUPPCState
*cpu_env
)
164 /* XXX: won't work when args goes on stack after gpr10 */
165 uint32_t args
= (uint32_t)(cpu_env
->gpr
[3+(*i
& 0xff)/4]);
167 return tswap32(args
);
169 static inline uint64_t get_int64_arg(int *i
, CPUPPCState
*cpu_env
)
171 /* XXX: won't work when args goes on stack after gpr10 */
172 uint64_t args
= (uint64_t)(cpu_env
->fpr
[1+(*i
>> 8)/8]);
174 return tswap64(args
);