Revision 2c0262af
b/linux-user/arm/syscall.h | ||
---|---|---|
1 |
|
|
2 |
/* this struct defines the way the registers are stored on the |
|
3 |
stack during a system call. */ |
|
4 |
|
|
5 |
struct target_pt_regs { |
|
6 |
target_long uregs[18]; |
|
7 |
}; |
|
8 |
|
|
9 |
#define ARM_cpsr uregs[16] |
|
10 |
#define ARM_pc uregs[15] |
|
11 |
#define ARM_lr uregs[14] |
|
12 |
#define ARM_sp uregs[13] |
|
13 |
#define ARM_ip uregs[12] |
|
14 |
#define ARM_fp uregs[11] |
|
15 |
#define ARM_r10 uregs[10] |
|
16 |
#define ARM_r9 uregs[9] |
|
17 |
#define ARM_r8 uregs[8] |
|
18 |
#define ARM_r7 uregs[7] |
|
19 |
#define ARM_r6 uregs[6] |
|
20 |
#define ARM_r5 uregs[5] |
|
21 |
#define ARM_r4 uregs[4] |
|
22 |
#define ARM_r3 uregs[3] |
|
23 |
#define ARM_r2 uregs[2] |
|
24 |
#define ARM_r1 uregs[1] |
|
25 |
#define ARM_r0 uregs[0] |
|
26 |
#define ARM_ORIG_r0 uregs[17] |
|
27 |
|
|
28 |
#define ARM_SYSCALL_BASE 0x900000 |
b/linux-user/arm/syscall_nr.h | ||
---|---|---|
1 |
/* |
|
2 |
* This file contains the system call numbers. |
|
3 |
*/ |
|
4 |
|
|
5 |
#define TARGET_NR_restart_syscall ( 0) |
|
6 |
#define TARGET_NR_exit ( 1) |
|
7 |
#define TARGET_NR_fork ( 2) |
|
8 |
#define TARGET_NR_read ( 3) |
|
9 |
#define TARGET_NR_write ( 4) |
|
10 |
#define TARGET_NR_open ( 5) |
|
11 |
#define TARGET_NR_close ( 6) |
|
12 |
#define TARGET_NR_waitpid ( 7) /* removed */ |
|
13 |
#define TARGET_NR_creat ( 8) |
|
14 |
#define TARGET_NR_link ( 9) |
|
15 |
#define TARGET_NR_unlink ( 10) |
|
16 |
#define TARGET_NR_execve ( 11) |
|
17 |
#define TARGET_NR_chdir ( 12) |
|
18 |
#define TARGET_NR_time ( 13) |
|
19 |
#define TARGET_NR_mknod ( 14) |
|
20 |
#define TARGET_NR_chmod ( 15) |
|
21 |
#define TARGET_NR_lchown ( 16) |
|
22 |
#define TARGET_NR_break ( 17) /* removed */ |
|
23 |
/* 18 was sys_stat */ |
|
24 |
#define TARGET_NR_lseek ( 19) |
|
25 |
#define TARGET_NR_getpid ( 20) |
|
26 |
#define TARGET_NR_mount ( 21) |
|
27 |
#define TARGET_NR_umount ( 22) |
|
28 |
#define TARGET_NR_setuid ( 23) |
|
29 |
#define TARGET_NR_getuid ( 24) |
|
30 |
#define TARGET_NR_stime ( 25) |
|
31 |
#define TARGET_NR_ptrace ( 26) |
|
32 |
#define TARGET_NR_alarm ( 27) |
|
33 |
|
|
34 |
#define TARGET_NR_pause ( 29) |
|
35 |
#define TARGET_NR_utime ( 30) |
|
36 |
#define TARGET_NR_stty ( 31) /* removed */ |
|
37 |
#define TARGET_NR_gtty ( 32) /* removed */ |
|
38 |
#define TARGET_NR_access ( 33) |
|
39 |
#define TARGET_NR_nice ( 34) |
|
40 |
#define TARGET_NR_ftime ( 35) /* removed */ |
|
41 |
#define TARGET_NR_sync ( 36) |
|
42 |
#define TARGET_NR_kill ( 37) |
|
43 |
#define TARGET_NR_rename ( 38) |
|
44 |
#define TARGET_NR_mkdir ( 39) |
|
45 |
#define TARGET_NR_rmdir ( 40) |
|
46 |
#define TARGET_NR_dup ( 41) |
|
47 |
#define TARGET_NR_pipe ( 42) |
|
48 |
#define TARGET_NR_times ( 43) |
|
49 |
#define TARGET_NR_prof ( 44) /* removed */ |
|
50 |
#define TARGET_NR_brk ( 45) |
|
51 |
#define TARGET_NR_setgid ( 46) |
|
52 |
#define TARGET_NR_getgid ( 47) |
|
53 |
#define TARGET_NR_signal ( 48) /* removed */ |
|
54 |
#define TARGET_NR_geteuid ( 49) |
|
55 |
#define TARGET_NR_getegid ( 50) |
|
56 |
#define TARGET_NR_acct ( 51) |
|
57 |
#define TARGET_NR_umount2 ( 52) |
|
58 |
#define TARGET_NR_lock ( 53) /* removed */ |
|
59 |
#define TARGET_NR_ioctl ( 54) |
|
60 |
#define TARGET_NR_fcntl ( 55) |
|
61 |
#define TARGET_NR_mpx ( 56) /* removed */ |
|
62 |
#define TARGET_NR_setpgid ( 57) |
|
63 |
#define TARGET_NR_ulimit ( 58) /* removed */ |
|
64 |
/* 59 was sys_olduname */ |
|
65 |
#define TARGET_NR_umask ( 60) |
|
66 |
#define TARGET_NR_chroot ( 61) |
|
67 |
#define TARGET_NR_ustat ( 62) |
|
68 |
#define TARGET_NR_dup2 ( 63) |
|
69 |
#define TARGET_NR_getppid ( 64) |
|
70 |
#define TARGET_NR_getpgrp ( 65) |
|
71 |
#define TARGET_NR_setsid ( 66) |
|
72 |
#define TARGET_NR_sigaction ( 67) |
|
73 |
#define TARGET_NR_sgetmask ( 68) /* removed */ |
|
74 |
#define TARGET_NR_ssetmask ( 69) /* removed */ |
|
75 |
#define TARGET_NR_setreuid ( 70) |
|
76 |
#define TARGET_NR_setregid ( 71) |
|
77 |
#define TARGET_NR_sigsuspend ( 72) |
|
78 |
#define TARGET_NR_sigpending ( 73) |
|
79 |
#define TARGET_NR_sethostname ( 74) |
|
80 |
#define TARGET_NR_setrlimit ( 75) |
|
81 |
#define TARGET_NR_getrlimit ( 76) /* Back compat 2GB limited rlimit */ |
|
82 |
#define TARGET_NR_getrusage ( 77) |
|
83 |
#define TARGET_NR_gettimeofday ( 78) |
|
84 |
#define TARGET_NR_settimeofday ( 79) |
|
85 |
#define TARGET_NR_getgroups ( 80) |
|
86 |
#define TARGET_NR_setgroups ( 81) |
|
87 |
#define TARGET_NR_select ( 82) |
|
88 |
#define TARGET_NR_symlink ( 83) |
|
89 |
/* 84 was sys_lstat */ |
|
90 |
#define TARGET_NR_readlink ( 85) |
|
91 |
#define TARGET_NR_uselib ( 86) |
|
92 |
#define TARGET_NR_swapon ( 87) |
|
93 |
#define TARGET_NR_reboot ( 88) |
|
94 |
#define TARGET_NR_readdir ( 89) |
|
95 |
#define TARGET_NR_mmap ( 90) |
|
96 |
#define TARGET_NR_munmap ( 91) |
|
97 |
#define TARGET_NR_truncate ( 92) |
|
98 |
#define TARGET_NR_ftruncate ( 93) |
|
99 |
#define TARGET_NR_fchmod ( 94) |
|
100 |
#define TARGET_NR_fchown ( 95) |
|
101 |
#define TARGET_NR_getpriority ( 96) |
|
102 |
#define TARGET_NR_setpriority ( 97) |
|
103 |
#define TARGET_NR_profil ( 98) /* removed */ |
|
104 |
#define TARGET_NR_statfs ( 99) |
|
105 |
#define TARGET_NR_fstatfs (100) |
|
106 |
#define TARGET_NR_ioperm (101) |
|
107 |
#define TARGET_NR_socketcall (102) |
|
108 |
#define TARGET_NR_syslog (103) |
|
109 |
#define TARGET_NR_setitimer (104) |
|
110 |
#define TARGET_NR_getitimer (105) |
|
111 |
#define TARGET_NR_stat (106) |
|
112 |
#define TARGET_NR_lstat (107) |
|
113 |
#define TARGET_NR_fstat (108) |
|
114 |
/* 109 was sys_uname */ |
|
115 |
/* 110 was sys_iopl */ |
|
116 |
#define TARGET_NR_vhangup (111) |
|
117 |
#define TARGET_NR_idle (112) |
|
118 |
#define TARGET_NR_syscall (113) /* syscall to call a syscall! */ |
|
119 |
#define TARGET_NR_wait4 (114) |
|
120 |
#define TARGET_NR_swapoff (115) |
|
121 |
#define TARGET_NR_sysinfo (116) |
|
122 |
#define TARGET_NR_ipc (117) |
|
123 |
#define TARGET_NR_fsync (118) |
|
124 |
#define TARGET_NR_sigreturn (119) |
|
125 |
#define TARGET_NR_clone (120) |
|
126 |
#define TARGET_NR_setdomainname (121) |
|
127 |
#define TARGET_NR_uname (122) |
|
128 |
#define TARGET_NR_modify_ldt (123) |
|
129 |
#define TARGET_NR_adjtimex (124) |
|
130 |
#define TARGET_NR_mprotect (125) |
|
131 |
#define TARGET_NR_sigprocmask (126) |
|
132 |
#define TARGET_NR_create_module (127) /* removed */ |
|
133 |
#define TARGET_NR_init_module (128) |
|
134 |
#define TARGET_NR_delete_module (129) |
|
135 |
#define TARGET_NR_get_kernel_syms (130) /* removed */ |
|
136 |
#define TARGET_NR_quotactl (131) |
|
137 |
#define TARGET_NR_getpgid (132) |
|
138 |
#define TARGET_NR_fchdir (133) |
|
139 |
#define TARGET_NR_bdflush (134) |
|
140 |
#define TARGET_NR_sysfs (135) |
|
141 |
#define TARGET_NR_personality (136) |
|
142 |
#define TARGET_NR_afs_syscall (137) /* Syscall for Andrew File System */ |
|
143 |
#define TARGET_NR_setfsuid (138) |
|
144 |
#define TARGET_NR_setfsgid (139) |
|
145 |
#define TARGET_NR__llseek (140) |
|
146 |
#define TARGET_NR_getdents (141) |
|
147 |
#define TARGET_NR__newselect (142) |
|
148 |
#define TARGET_NR_flock (143) |
|
149 |
#define TARGET_NR_msync (144) |
|
150 |
#define TARGET_NR_readv (145) |
|
151 |
#define TARGET_NR_writev (146) |
|
152 |
#define TARGET_NR_getsid (147) |
|
153 |
#define TARGET_NR_fdatasync (148) |
|
154 |
#define TARGET_NR__sysctl (149) |
|
155 |
#define TARGET_NR_mlock (150) |
|
156 |
#define TARGET_NR_munlock (151) |
|
157 |
#define TARGET_NR_mlockall (152) |
|
158 |
#define TARGET_NR_munlockall (153) |
|
159 |
#define TARGET_NR_sched_setparam (154) |
|
160 |
#define TARGET_NR_sched_getparam (155) |
|
161 |
#define TARGET_NR_sched_setscheduler (156) |
|
162 |
#define TARGET_NR_sched_getscheduler (157) |
|
163 |
#define TARGET_NR_sched_yield (158) |
|
164 |
#define TARGET_NR_sched_get_priority_max (159) |
|
165 |
#define TARGET_NR_sched_get_priority_min (160) |
|
166 |
#define TARGET_NR_sched_rr_get_interval (161) |
|
167 |
#define TARGET_NR_nanosleep (162) |
|
168 |
#define TARGET_NR_mremap (163) |
|
169 |
#define TARGET_NR_setresuid (164) |
|
170 |
#define TARGET_NR_getresuid (165) |
|
171 |
#define TARGET_NR_vm86 (166) /* removed */ |
|
172 |
#define TARGET_NR_query_module (167) /* removed */ |
|
173 |
#define TARGET_NR_poll (168) |
|
174 |
#define TARGET_NR_nfsservctl (169) |
|
175 |
#define TARGET_NR_setresgid (170) |
|
176 |
#define TARGET_NR_getresgid (171) |
|
177 |
#define TARGET_NR_prctl (172) |
|
178 |
#define TARGET_NR_rt_sigreturn (173) |
|
179 |
#define TARGET_NR_rt_sigaction (174) |
|
180 |
#define TARGET_NR_rt_sigprocmask (175) |
|
181 |
#define TARGET_NR_rt_sigpending (176) |
|
182 |
#define TARGET_NR_rt_sigtimedwait (177) |
|
183 |
#define TARGET_NR_rt_sigqueueinfo (178) |
|
184 |
#define TARGET_NR_rt_sigsuspend (179) |
|
185 |
#define TARGET_NR_pread (180) |
|
186 |
#define TARGET_NR_pwrite (181) |
|
187 |
#define TARGET_NR_chown (182) |
|
188 |
#define TARGET_NR_getcwd (183) |
|
189 |
#define TARGET_NR_capget (184) |
|
190 |
#define TARGET_NR_capset (185) |
|
191 |
#define TARGET_NR_sigaltstack (186) |
|
192 |
#define TARGET_NR_sendfile (187) |
|
193 |
/* 188 reserved */ |
|
194 |
/* 189 reserved */ |
|
195 |
#define TARGET_NR_vfork (190) |
|
196 |
#define TARGET_NR_ugetrlimit (191) /* SuS compliant getrlimit */ |
|
197 |
#define TARGET_NR_mmap2 (192) |
|
198 |
#define TARGET_NR_truncate64 (193) |
|
199 |
#define TARGET_NR_ftruncate64 (194) |
|
200 |
#define TARGET_NR_stat64 (195) |
|
201 |
#define TARGET_NR_lstat64 (196) |
|
202 |
#define TARGET_NR_fstat64 (197) |
|
203 |
#define TARGET_NR_lchown32 (198) |
|
204 |
#define TARGET_NR_getuid32 (199) |
|
205 |
#define TARGET_NR_getgid32 (200) |
|
206 |
#define TARGET_NR_geteuid32 (201) |
|
207 |
#define TARGET_NR_getegid32 (202) |
|
208 |
#define TARGET_NR_setreuid32 (203) |
|
209 |
#define TARGET_NR_setregid32 (204) |
|
210 |
#define TARGET_NR_getgroups32 (205) |
|
211 |
#define TARGET_NR_setgroups32 (206) |
|
212 |
#define TARGET_NR_fchown32 (207) |
|
213 |
#define TARGET_NR_setresuid32 (208) |
|
214 |
#define TARGET_NR_getresuid32 (209) |
|
215 |
#define TARGET_NR_setresgid32 (210) |
|
216 |
#define TARGET_NR_getresgid32 (211) |
|
217 |
#define TARGET_NR_chown32 (212) |
|
218 |
#define TARGET_NR_setuid32 (213) |
|
219 |
#define TARGET_NR_setgid32 (214) |
|
220 |
#define TARGET_NR_setfsuid32 (215) |
|
221 |
#define TARGET_NR_setfsgid32 (216) |
|
222 |
#define TARGET_NR_getdents64 (217) |
|
223 |
#define TARGET_NR_pivot_root (218) |
|
224 |
#define TARGET_NR_mincore (219) |
|
225 |
#define TARGET_NR_madvise (220) |
|
226 |
#define TARGET_NR_fcntl64 (221) |
|
227 |
/* 222 for tux */ |
|
228 |
/* 223 is unused */ |
|
229 |
#define TARGET_NR_gettid (224) |
|
230 |
#define TARGET_NR_readahead (225) |
|
231 |
#define TARGET_NR_setxattr (226) |
|
232 |
#define TARGET_NR_lsetxattr (227) |
|
233 |
#define TARGET_NR_fsetxattr (228) |
|
234 |
#define TARGET_NR_getxattr (229) |
|
235 |
#define TARGET_NR_lgetxattr (230) |
|
236 |
#define TARGET_NR_fgetxattr (231) |
|
237 |
#define TARGET_NR_listxattr (232) |
|
238 |
#define TARGET_NR_llistxattr (233) |
|
239 |
#define TARGET_NR_flistxattr (234) |
|
240 |
#define TARGET_NR_removexattr (235) |
|
241 |
#define TARGET_NR_lremovexattr (236) |
|
242 |
#define TARGET_NR_fremovexattr (237) |
|
243 |
#define TARGET_NR_tkill (238) |
|
244 |
#define TARGET_NR_sendfile64 (239) |
|
245 |
#define TARGET_NR_futex (240) |
|
246 |
#define TARGET_NR_sched_setaffinity (241) |
|
247 |
#define TARGET_NR_sched_getaffinity (242) |
|
248 |
#define TARGET_NR_io_setup (243) |
|
249 |
#define TARGET_NR_io_destroy (244) |
|
250 |
#define TARGET_NR_io_getevents (245) |
|
251 |
#define TARGET_NR_io_submit (246) |
|
252 |
#define TARGET_NR_io_cancel (247) |
|
253 |
#define TARGET_NR_exit_group (248) |
|
254 |
#define TARGET_NR_lookup_dcookie (249) |
|
255 |
#define TARGET_NR_epoll_create (250) |
|
256 |
#define TARGET_NR_epoll_ctl (251) |
|
257 |
#define TARGET_NR_epoll_wait (252) |
|
258 |
#define TARGET_NR_remap_file_pages (253) |
|
259 |
/* 254 for set_thread_area */ |
|
260 |
/* 255 for get_thread_area */ |
|
261 |
/* 256 for set_tid_address */ |
b/linux-user/i386/syscall.h | ||
---|---|---|
1 |
/* default linux values for the selectors */ |
|
2 |
#define __USER_CS (0x23) |
|
3 |
#define __USER_DS (0x2B) |
|
4 |
|
|
5 |
struct target_pt_regs { |
|
6 |
long ebx; |
|
7 |
long ecx; |
|
8 |
long edx; |
|
9 |
long esi; |
|
10 |
long edi; |
|
11 |
long ebp; |
|
12 |
long eax; |
|
13 |
int xds; |
|
14 |
int xes; |
|
15 |
long orig_eax; |
|
16 |
long eip; |
|
17 |
int xcs; |
|
18 |
long eflags; |
|
19 |
long esp; |
|
20 |
int xss; |
|
21 |
}; |
|
22 |
|
|
23 |
/* ioctls */ |
|
24 |
|
|
25 |
#define TARGET_LDT_ENTRIES 8192 |
|
26 |
#define TARGET_LDT_ENTRY_SIZE 8 |
|
27 |
|
|
28 |
#define TARGET_GDT_ENTRY_TLS_ENTRIES 3 |
|
29 |
#define TARGET_GDT_ENTRY_TLS_MIN 6 |
|
30 |
#define TARGET_GDT_ENTRY_TLS_MAX (TARGET_GDT_ENTRY_TLS_MIN + TARGET_GDT_ENTRY_TLS_ENTRIES - 1) |
|
31 |
|
|
32 |
struct target_modify_ldt_ldt_s { |
|
33 |
unsigned int entry_number; |
|
34 |
target_ulong base_addr; |
|
35 |
unsigned int limit; |
|
36 |
unsigned int flags; |
|
37 |
}; |
|
38 |
|
|
39 |
/* vm86 defines */ |
|
40 |
|
|
41 |
#define TARGET_BIOSSEG 0x0f000 |
|
42 |
|
|
43 |
#define TARGET_CPU_086 0 |
|
44 |
#define TARGET_CPU_186 1 |
|
45 |
#define TARGET_CPU_286 2 |
|
46 |
#define TARGET_CPU_386 3 |
|
47 |
#define TARGET_CPU_486 4 |
|
48 |
#define TARGET_CPU_586 5 |
|
49 |
|
|
50 |
#define TARGET_VM86_SIGNAL 0 /* return due to signal */ |
|
51 |
#define TARGET_VM86_UNKNOWN 1 /* unhandled GP fault - IO-instruction or similar */ |
|
52 |
#define TARGET_VM86_INTx 2 /* int3/int x instruction (ARG = x) */ |
|
53 |
#define TARGET_VM86_STI 3 /* sti/popf/iret instruction enabled virtual interrupts */ |
|
54 |
|
|
55 |
/* |
|
56 |
* Additional return values when invoking new vm86() |
|
57 |
*/ |
|
58 |
#define TARGET_VM86_PICRETURN 4 /* return due to pending PIC request */ |
|
59 |
#define TARGET_VM86_TRAP 6 /* return due to DOS-debugger request */ |
|
60 |
|
|
61 |
/* |
|
62 |
* function codes when invoking new vm86() |
|
63 |
*/ |
|
64 |
#define TARGET_VM86_PLUS_INSTALL_CHECK 0 |
|
65 |
#define TARGET_VM86_ENTER 1 |
|
66 |
#define TARGET_VM86_ENTER_NO_BYPASS 2 |
|
67 |
#define TARGET_VM86_REQUEST_IRQ 3 |
|
68 |
#define TARGET_VM86_FREE_IRQ 4 |
|
69 |
#define TARGET_VM86_GET_IRQ_BITS 5 |
|
70 |
#define TARGET_VM86_GET_AND_RESET_IRQ 6 |
|
71 |
|
|
72 |
/* |
|
73 |
* This is the stack-layout seen by the user space program when we have |
|
74 |
* done a translation of "SAVE_ALL" from vm86 mode. The real kernel layout |
|
75 |
* is 'kernel_vm86_regs' (see below). |
|
76 |
*/ |
|
77 |
|
|
78 |
struct target_vm86_regs { |
|
79 |
/* |
|
80 |
* normal regs, with special meaning for the segment descriptors.. |
|
81 |
*/ |
|
82 |
target_long ebx; |
|
83 |
target_long ecx; |
|
84 |
target_long edx; |
|
85 |
target_long esi; |
|
86 |
target_long edi; |
|
87 |
target_long ebp; |
|
88 |
target_long eax; |
|
89 |
target_long __null_ds; |
|
90 |
target_long __null_es; |
|
91 |
target_long __null_fs; |
|
92 |
target_long __null_gs; |
|
93 |
target_long orig_eax; |
|
94 |
target_long eip; |
|
95 |
unsigned short cs, __csh; |
|
96 |
target_long eflags; |
|
97 |
target_long esp; |
|
98 |
unsigned short ss, __ssh; |
|
99 |
/* |
|
100 |
* these are specific to v86 mode: |
|
101 |
*/ |
|
102 |
unsigned short es, __esh; |
|
103 |
unsigned short ds, __dsh; |
|
104 |
unsigned short fs, __fsh; |
|
105 |
unsigned short gs, __gsh; |
|
106 |
}; |
|
107 |
|
|
108 |
struct target_revectored_struct { |
|
109 |
target_ulong __map[8]; /* 256 bits */ |
|
110 |
}; |
|
111 |
|
|
112 |
struct target_vm86_struct { |
|
113 |
struct target_vm86_regs regs; |
|
114 |
target_ulong flags; |
|
115 |
target_ulong screen_bitmap; |
|
116 |
target_ulong cpu_type; |
|
117 |
struct target_revectored_struct int_revectored; |
|
118 |
struct target_revectored_struct int21_revectored; |
|
119 |
}; |
|
120 |
|
|
121 |
/* |
|
122 |
* flags masks |
|
123 |
*/ |
|
124 |
#define TARGET_VM86_SCREEN_BITMAP 0x0001 |
|
125 |
|
|
126 |
struct target_vm86plus_info_struct { |
|
127 |
target_ulong flags; |
|
128 |
#define TARGET_force_return_for_pic (1 << 0) |
|
129 |
#define TARGET_vm86dbg_active (1 << 1) /* for debugger */ |
|
130 |
#define TARGET_vm86dbg_TFpendig (1 << 2) /* for debugger */ |
|
131 |
#define TARGET_is_vm86pus (1 << 31) /* for vm86 internal use */ |
|
132 |
unsigned char vm86dbg_intxxtab[32]; /* for debugger */ |
|
133 |
}; |
|
134 |
|
|
135 |
struct target_vm86plus_struct { |
|
136 |
struct target_vm86_regs regs; |
|
137 |
target_ulong flags; |
|
138 |
target_ulong screen_bitmap; |
|
139 |
target_ulong cpu_type; |
|
140 |
struct target_revectored_struct int_revectored; |
|
141 |
struct target_revectored_struct int21_revectored; |
|
142 |
struct target_vm86plus_info_struct vm86plus; |
|
143 |
}; |
|
144 |
|
|
145 |
/* ipcs */ |
|
146 |
|
|
147 |
#define TARGET_SEMOP 1 |
|
148 |
#define TARGET_SEMGET 2 |
|
149 |
#define TARGET_SEMCTL 3 |
|
150 |
#define TARGET_MSGSND 11 |
|
151 |
#define TARGET_MSGRCV 12 |
|
152 |
#define TARGET_MSGGET 13 |
|
153 |
#define TARGET_MSGCTL 14 |
|
154 |
#define TARGET_SHMAT 21 |
|
155 |
#define TARGET_SHMDT 22 |
|
156 |
#define TARGET_SHMGET 23 |
|
157 |
#define TARGET_SHMCTL 24 |
|
158 |
|
|
159 |
struct target_msgbuf { |
|
160 |
int mtype; |
|
161 |
char mtext[1]; |
|
162 |
}; |
|
163 |
|
|
164 |
struct target_ipc_kludge { |
|
165 |
unsigned int msgp; /* Really (struct msgbuf *) */ |
|
166 |
int msgtyp; |
|
167 |
}; |
|
168 |
|
|
169 |
struct target_ipc_perm { |
|
170 |
int key; |
|
171 |
unsigned short uid; |
|
172 |
unsigned short gid; |
|
173 |
unsigned short cuid; |
|
174 |
unsigned short cgid; |
|
175 |
unsigned short mode; |
|
176 |
unsigned short seq; |
|
177 |
}; |
|
178 |
|
|
179 |
struct target_msqid_ds { |
|
180 |
struct target_ipc_perm msg_perm; |
|
181 |
unsigned int msg_first; /* really struct target_msg* */ |
|
182 |
unsigned int msg_last; /* really struct target_msg* */ |
|
183 |
unsigned int msg_stime; /* really target_time_t */ |
|
184 |
unsigned int msg_rtime; /* really target_time_t */ |
|
185 |
unsigned int msg_ctime; /* really target_time_t */ |
|
186 |
unsigned int wwait; /* really struct wait_queue* */ |
|
187 |
unsigned int rwait; /* really struct wait_queue* */ |
|
188 |
unsigned short msg_cbytes; |
|
189 |
unsigned short msg_qnum; |
|
190 |
unsigned short msg_qbytes; |
|
191 |
unsigned short msg_lspid; |
|
192 |
unsigned short msg_lrpid; |
|
193 |
}; |
|
194 |
|
|
195 |
struct target_shmid_ds { |
|
196 |
struct target_ipc_perm shm_perm; |
|
197 |
int shm_segsz; |
|
198 |
unsigned int shm_atime; /* really target_time_t */ |
|
199 |
unsigned int shm_dtime; /* really target_time_t */ |
|
200 |
unsigned int shm_ctime; /* really target_time_t */ |
|
201 |
unsigned short shm_cpid; |
|
202 |
unsigned short shm_lpid; |
|
203 |
short shm_nattch; |
|
204 |
unsigned short shm_npages; |
|
205 |
unsigned long *shm_pages; |
|
206 |
void *attaches; /* really struct shm_desc * */ |
|
207 |
}; |
|
208 |
|
|
209 |
#define TARGET_IPC_RMID 0 |
|
210 |
#define TARGET_IPC_SET 1 |
|
211 |
#define TARGET_IPC_STAT 2 |
|
212 |
|
|
213 |
union target_semun { |
|
214 |
int val; |
|
215 |
unsigned int buf; /* really struct semid_ds * */ |
|
216 |
unsigned int array; /* really unsigned short * */ |
|
217 |
unsigned int __buf; /* really struct seminfo * */ |
|
218 |
unsigned int __pad; /* really void* */ |
|
219 |
}; |
|
220 |
|
b/linux-user/i386/syscall_nr.h | ||
---|---|---|
1 |
/* |
|
2 |
* This file contains the system call numbers. |
|
3 |
*/ |
|
4 |
|
|
5 |
#define TARGET_NR_restart_syscall 0 |
|
6 |
#define TARGET_NR_exit 1 |
|
7 |
#define TARGET_NR_fork 2 |
|
8 |
#define TARGET_NR_read 3 |
|
9 |
#define TARGET_NR_write 4 |
|
10 |
#define TARGET_NR_open 5 |
|
11 |
#define TARGET_NR_close 6 |
|
12 |
#define TARGET_NR_waitpid 7 |
|
13 |
#define TARGET_NR_creat 8 |
|
14 |
#define TARGET_NR_link 9 |
|
15 |
#define TARGET_NR_unlink 10 |
|
16 |
#define TARGET_NR_execve 11 |
|
17 |
#define TARGET_NR_chdir 12 |
|
18 |
#define TARGET_NR_time 13 |
|
19 |
#define TARGET_NR_mknod 14 |
|
20 |
#define TARGET_NR_chmod 15 |
|
21 |
#define TARGET_NR_lchown 16 |
|
22 |
#define TARGET_NR_break 17 |
|
23 |
#define TARGET_NR_oldstat 18 |
|
24 |
#define TARGET_NR_lseek 19 |
|
25 |
#define TARGET_NR_getpid 20 |
|
26 |
#define TARGET_NR_mount 21 |
|
27 |
#define TARGET_NR_umount 22 |
|
28 |
#define TARGET_NR_setuid 23 |
|
29 |
#define TARGET_NR_getuid 24 |
|
30 |
#define TARGET_NR_stime 25 |
|
31 |
#define TARGET_NR_ptrace 26 |
|
32 |
#define TARGET_NR_alarm 27 |
|
33 |
#define TARGET_NR_oldfstat 28 |
|
34 |
#define TARGET_NR_pause 29 |
|
35 |
#define TARGET_NR_utime 30 |
|
36 |
#define TARGET_NR_stty 31 |
|
37 |
#define TARGET_NR_gtty 32 |
|
38 |
#define TARGET_NR_access 33 |
|
39 |
#define TARGET_NR_nice 34 |
|
40 |
#define TARGET_NR_ftime 35 |
|
41 |
#define TARGET_NR_sync 36 |
|
42 |
#define TARGET_NR_kill 37 |
|
43 |
#define TARGET_NR_rename 38 |
|
44 |
#define TARGET_NR_mkdir 39 |
|
45 |
#define TARGET_NR_rmdir 40 |
|
46 |
#define TARGET_NR_dup 41 |
|
47 |
#define TARGET_NR_pipe 42 |
|
48 |
#define TARGET_NR_times 43 |
|
49 |
#define TARGET_NR_prof 44 |
|
50 |
#define TARGET_NR_brk 45 |
|
51 |
#define TARGET_NR_setgid 46 |
|
52 |
#define TARGET_NR_getgid 47 |
|
53 |
#define TARGET_NR_signal 48 |
|
54 |
#define TARGET_NR_geteuid 49 |
|
55 |
#define TARGET_NR_getegid 50 |
|
56 |
#define TARGET_NR_acct 51 |
|
57 |
#define TARGET_NR_umount2 52 |
|
58 |
#define TARGET_NR_lock 53 |
|
59 |
#define TARGET_NR_ioctl 54 |
|
60 |
#define TARGET_NR_fcntl 55 |
|
61 |
#define TARGET_NR_mpx 56 |
|
62 |
#define TARGET_NR_setpgid 57 |
|
63 |
#define TARGET_NR_ulimit 58 |
|
64 |
#define TARGET_NR_oldolduname 59 |
|
65 |
#define TARGET_NR_umask 60 |
|
66 |
#define TARGET_NR_chroot 61 |
|
67 |
#define TARGET_NR_ustat 62 |
|
68 |
#define TARGET_NR_dup2 63 |
|
69 |
#define TARGET_NR_getppid 64 |
|
70 |
#define TARGET_NR_getpgrp 65 |
|
71 |
#define TARGET_NR_setsid 66 |
|
72 |
#define TARGET_NR_sigaction 67 |
|
73 |
#define TARGET_NR_sgetmask 68 |
|
74 |
#define TARGET_NR_ssetmask 69 |
|
75 |
#define TARGET_NR_setreuid 70 |
|
76 |
#define TARGET_NR_setregid 71 |
|
77 |
#define TARGET_NR_sigsuspend 72 |
|
78 |
#define TARGET_NR_sigpending 73 |
|
79 |
#define TARGET_NR_sethostname 74 |
|
80 |
#define TARGET_NR_setrlimit 75 |
|
81 |
#define TARGET_NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */ |
|
82 |
#define TARGET_NR_getrusage 77 |
|
83 |
#define TARGET_NR_gettimeofday 78 |
|
84 |
#define TARGET_NR_settimeofday 79 |
|
85 |
#define TARGET_NR_getgroups 80 |
|
86 |
#define TARGET_NR_setgroups 81 |
|
87 |
#define TARGET_NR_select 82 |
|
88 |
#define TARGET_NR_symlink 83 |
|
89 |
#define TARGET_NR_oldlstat 84 |
|
90 |
#define TARGET_NR_readlink 85 |
|
91 |
#define TARGET_NR_uselib 86 |
|
92 |
#define TARGET_NR_swapon 87 |
|
93 |
#define TARGET_NR_reboot 88 |
|
94 |
#define TARGET_NR_readdir 89 |
|
95 |
#define TARGET_NR_mmap 90 |
|
96 |
#define TARGET_NR_munmap 91 |
|
97 |
#define TARGET_NR_truncate 92 |
|
98 |
#define TARGET_NR_ftruncate 93 |
|
99 |
#define TARGET_NR_fchmod 94 |
|
100 |
#define TARGET_NR_fchown 95 |
|
101 |
#define TARGET_NR_getpriority 96 |
|
102 |
#define TARGET_NR_setpriority 97 |
|
103 |
#define TARGET_NR_profil 98 |
|
104 |
#define TARGET_NR_statfs 99 |
|
105 |
#define TARGET_NR_fstatfs 100 |
|
106 |
#define TARGET_NR_ioperm 101 |
|
107 |
#define TARGET_NR_socketcall 102 |
|
108 |
#define TARGET_NR_syslog 103 |
|
109 |
#define TARGET_NR_setitimer 104 |
|
110 |
#define TARGET_NR_getitimer 105 |
|
111 |
#define TARGET_NR_stat 106 |
|
112 |
#define TARGET_NR_lstat 107 |
|
113 |
#define TARGET_NR_fstat 108 |
|
114 |
#define TARGET_NR_olduname 109 |
|
115 |
#define TARGET_NR_iopl 110 |
|
116 |
#define TARGET_NR_vhangup 111 |
|
117 |
#define TARGET_NR_idle 112 |
|
118 |
#define TARGET_NR_vm86old 113 |
|
119 |
#define TARGET_NR_wait4 114 |
|
120 |
#define TARGET_NR_swapoff 115 |
|
121 |
#define TARGET_NR_sysinfo 116 |
|
122 |
#define TARGET_NR_ipc 117 |
|
123 |
#define TARGET_NR_fsync 118 |
|
124 |
#define TARGET_NR_sigreturn 119 |
|
125 |
#define TARGET_NR_clone 120 |
|
126 |
#define TARGET_NR_setdomainname 121 |
|
127 |
#define TARGET_NR_uname 122 |
|
128 |
#define TARGET_NR_modify_ldt 123 |
|
129 |
#define TARGET_NR_adjtimex 124 |
|
130 |
#define TARGET_NR_mprotect 125 |
|
131 |
#define TARGET_NR_sigprocmask 126 |
|
132 |
#define TARGET_NR_create_module 127 |
|
133 |
#define TARGET_NR_init_module 128 |
|
134 |
#define TARGET_NR_delete_module 129 |
|
135 |
#define TARGET_NR_get_kernel_syms 130 |
|
136 |
#define TARGET_NR_quotactl 131 |
|
137 |
#define TARGET_NR_getpgid 132 |
|
138 |
#define TARGET_NR_fchdir 133 |
|
139 |
#define TARGET_NR_bdflush 134 |
|
140 |
#define TARGET_NR_sysfs 135 |
|
141 |
#define TARGET_NR_personality 136 |
|
142 |
#define TARGET_NR_afs_syscall 137 /* Syscall for Andrew File System */ |
|
143 |
#define TARGET_NR_setfsuid 138 |
|
144 |
#define TARGET_NR_setfsgid 139 |
|
145 |
#define TARGET_NR__llseek 140 |
|
146 |
#define TARGET_NR_getdents 141 |
|
147 |
#define TARGET_NR__newselect 142 |
|
148 |
#define TARGET_NR_flock 143 |
|
149 |
#define TARGET_NR_msync 144 |
|
150 |
#define TARGET_NR_readv 145 |
|
151 |
#define TARGET_NR_writev 146 |
|
152 |
#define TARGET_NR_getsid 147 |
|
153 |
#define TARGET_NR_fdatasync 148 |
|
154 |
#define TARGET_NR__sysctl 149 |
|
155 |
#define TARGET_NR_mlock 150 |
|
156 |
#define TARGET_NR_munlock 151 |
|
157 |
#define TARGET_NR_mlockall 152 |
|
158 |
#define TARGET_NR_munlockall 153 |
|
159 |
#define TARGET_NR_sched_setparam 154 |
|
160 |
#define TARGET_NR_sched_getparam 155 |
|
161 |
#define TARGET_NR_sched_setscheduler 156 |
|
162 |
#define TARGET_NR_sched_getscheduler 157 |
|
163 |
#define TARGET_NR_sched_yield 158 |
|
164 |
#define TARGET_NR_sched_get_priority_max 159 |
|
165 |
#define TARGET_NR_sched_get_priority_min 160 |
|
166 |
#define TARGET_NR_sched_rr_get_interval 161 |
|
167 |
#define TARGET_NR_nanosleep 162 |
|
168 |
#define TARGET_NR_mremap 163 |
|
169 |
#define TARGET_NR_setresuid 164 |
|
170 |
#define TARGET_NR_getresuid 165 |
|
171 |
#define TARGET_NR_vm86 166 |
|
172 |
#define TARGET_NR_query_module 167 |
|
173 |
#define TARGET_NR_poll 168 |
|
174 |
#define TARGET_NR_nfsservctl 169 |
|
175 |
#define TARGET_NR_setresgid 170 |
|
176 |
#define TARGET_NR_getresgid 171 |
|
177 |
#define TARGET_NR_prctl 172 |
|
178 |
#define TARGET_NR_rt_sigreturn 173 |
|
179 |
#define TARGET_NR_rt_sigaction 174 |
|
180 |
#define TARGET_NR_rt_sigprocmask 175 |
|
181 |
#define TARGET_NR_rt_sigpending 176 |
|
182 |
#define TARGET_NR_rt_sigtimedwait 177 |
|
183 |
#define TARGET_NR_rt_sigqueueinfo 178 |
|
184 |
#define TARGET_NR_rt_sigsuspend 179 |
|
185 |
#define TARGET_NR_pread 180 |
|
186 |
#define TARGET_NR_pwrite 181 |
|
187 |
#define TARGET_NR_chown 182 |
|
188 |
#define TARGET_NR_getcwd 183 |
|
189 |
#define TARGET_NR_capget 184 |
|
190 |
#define TARGET_NR_capset 185 |
|
191 |
#define TARGET_NR_sigaltstack 186 |
|
192 |
#define TARGET_NR_sendfile 187 |
|
193 |
#define TARGET_NR_getpmsg 188 /* some people actually want streams */ |
|
194 |
#define TARGET_NR_putpmsg 189 /* some people actually want streams */ |
|
195 |
#define TARGET_NR_vfork 190 |
|
196 |
#define TARGET_NR_ugetrlimit 191 /* SuS compliant getrlimit */ |
|
197 |
#define TARGET_NR_mmap2 192 |
|
198 |
#define TARGET_NR_truncate64 193 |
|
199 |
#define TARGET_NR_ftruncate64 194 |
|
200 |
#define TARGET_NR_stat64 195 |
|
201 |
#define TARGET_NR_lstat64 196 |
|
202 |
#define TARGET_NR_fstat64 197 |
|
203 |
#define TARGET_NR_lchown32 198 |
|
204 |
#define TARGET_NR_getuid32 199 |
|
205 |
#define TARGET_NR_getgid32 200 |
|
206 |
#define TARGET_NR_geteuid32 201 |
|
207 |
#define TARGET_NR_getegid32 202 |
|
208 |
#define TARGET_NR_setreuid32 203 |
|
209 |
#define TARGET_NR_setregid32 204 |
|
210 |
#define TARGET_NR_getgroups32 205 |
|
211 |
#define TARGET_NR_setgroups32 206 |
|
212 |
#define TARGET_NR_fchown32 207 |
|
213 |
#define TARGET_NR_setresuid32 208 |
|
214 |
#define TARGET_NR_getresuid32 209 |
|
215 |
#define TARGET_NR_setresgid32 210 |
|
216 |
#define TARGET_NR_getresgid32 211 |
|
217 |
#define TARGET_NR_chown32 212 |
|
218 |
#define TARGET_NR_setuid32 213 |
|
219 |
#define TARGET_NR_setgid32 214 |
|
220 |
#define TARGET_NR_setfsuid32 215 |
|
221 |
#define TARGET_NR_setfsgid32 216 |
|
222 |
#define TARGET_NR_pivot_root 217 |
|
223 |
#define TARGET_NR_mincore 218 |
|
224 |
#define TARGET_NR_madvise 219 |
|
225 |
#define TARGET_NR_madvise1 219 /* delete when C lib stub is removed */ |
|
226 |
#define TARGET_NR_getdents64 220 |
|
227 |
#define TARGET_NR_fcntl64 221 |
|
228 |
/* 223 is unused */ |
|
229 |
#define TARGET_NR_gettid 224 |
|
230 |
#define TARGET_NR_readahead 225 |
|
231 |
#define TARGET_NR_setxattr 226 |
|
232 |
#define TARGET_NR_lsetxattr 227 |
|
233 |
#define TARGET_NR_fsetxattr 228 |
|
234 |
#define TARGET_NR_getxattr 229 |
|
235 |
#define TARGET_NR_lgetxattr 230 |
|
236 |
#define TARGET_NR_fgetxattr 231 |
|
237 |
#define TARGET_NR_listxattr 232 |
|
238 |
#define TARGET_NR_llistxattr 233 |
|
239 |
#define TARGET_NR_flistxattr 234 |
|
240 |
#define TARGET_NR_removexattr 235 |
|
241 |
#define TARGET_NR_lremovexattr 236 |
|
242 |
#define TARGET_NR_fremovexattr 237 |
|
243 |
#define TARGET_NR_tkill 238 |
|
244 |
#define TARGET_NR_sendfile64 239 |
|
245 |
#define TARGET_NR_futex 240 |
|
246 |
#define TARGET_NR_sched_setaffinity 241 |
|
247 |
#define TARGET_NR_sched_getaffinity 242 |
|
248 |
#define TARGET_NR_set_thread_area 243 |
|
249 |
#define TARGET_NR_get_thread_area 244 |
|
250 |
#define TARGET_NR_io_setup 245 |
|
251 |
#define TARGET_NR_io_destroy 246 |
|
252 |
#define TARGET_NR_io_getevents 247 |
|
253 |
#define TARGET_NR_io_submit 248 |
|
254 |
#define TARGET_NR_io_cancel 249 |
|
255 |
#define TARGET_NR_fadvise64 250 |
|
256 |
|
|
257 |
#define TARGET_NR_exit_group 252 |
|
258 |
#define TARGET_NR_lookup_dcookie 253 |
|
259 |
#define TARGET_NR_epoll_create 254 |
|
260 |
#define TARGET_NR_epoll_ctl 255 |
|
261 |
#define TARGET_NR_epoll_wait 256 |
|
262 |
#define TARGET_NR_remap_file_pages 257 |
|
263 |
#define TARGET_NR_set_tid_address 258 |
|
264 |
#define TARGET_NR_timer_create 259 |
|
265 |
#define TARGET_NR_timer_settime (TARGET_NR_timer_create+1) |
|
266 |
#define TARGET_NR_timer_gettime (TARGET_NR_timer_create+2) |
|
267 |
#define TARGET_NR_timer_getoverrun (TARGET_NR_timer_create+3) |
|
268 |
#define TARGET_NR_timer_delete (TARGET_NR_timer_create+4) |
|
269 |
#define TARGET_NR_clock_settime (TARGET_NR_timer_create+5) |
|
270 |
#define TARGET_NR_clock_gettime (TARGET_NR_timer_create+6) |
|
271 |
#define TARGET_NR_clock_getres (TARGET_NR_timer_create+7) |
|
272 |
#define TARGET_NR_clock_nanosleep (TARGET_NR_timer_create+8) |
|
273 |
|
b/target-arm/cpu.h | ||
---|---|---|
1 |
/* |
|
2 |
* ARM virtual CPU header |
|
3 |
* |
|
4 |
* Copyright (c) 2003 Fabrice Bellard |
|
5 |
* |
|
6 |
* This library is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU Lesser General Public |
|
8 |
* License as published by the Free Software Foundation; either |
|
9 |
* version 2 of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This library is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 |
* Lesser General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU Lesser General Public |
|
17 |
* License along with this library; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
19 |
*/ |
|
20 |
#ifndef CPU_ARM_H |
|
21 |
#define CPU_ARM_H |
|
22 |
|
|
23 |
#include "cpu-defs.h" |
|
24 |
|
|
25 |
#define EXCP_UDEF 1 /* undefined instruction */ |
|
26 |
#define EXCP_SWI 2 /* software interrupt */ |
|
27 |
|
|
28 |
typedef struct CPUARMState { |
|
29 |
uint32_t regs[16]; |
|
30 |
uint32_t cpsr; |
|
31 |
|
|
32 |
/* cpsr flag cache for faster execution */ |
|
33 |
uint32_t CF; /* 0 or 1 */ |
|
34 |
uint32_t VF; /* V is the bit 31. All other bits are undefined */ |
|
35 |
uint32_t NZF; /* N is bit 31. Z is computed from NZF */ |
|
36 |
|
|
37 |
/* exception/interrupt handling */ |
|
38 |
jmp_buf jmp_env; |
|
39 |
int exception_index; |
|
40 |
int interrupt_request; |
|
41 |
struct TranslationBlock *current_tb; |
|
42 |
int user_mode_only; |
|
43 |
|
|
44 |
/* user data */ |
|
45 |
void *opaque; |
|
46 |
} CPUARMState; |
|
47 |
|
|
48 |
CPUARMState *cpu_arm_init(void); |
|
49 |
int cpu_arm_exec(CPUARMState *s); |
|
50 |
void cpu_arm_close(CPUARMState *s); |
|
51 |
/* you can call this signal handler from your SIGBUS and SIGSEGV |
|
52 |
signal handlers to inform the virtual CPU of exceptions. non zero |
|
53 |
is returned if the signal was handled by the virtual CPU. */ |
|
54 |
struct siginfo; |
|
55 |
int cpu_arm_signal_handler(int host_signum, struct siginfo *info, |
|
56 |
void *puc); |
|
57 |
|
|
58 |
void cpu_arm_dump_state(CPUARMState *env, FILE *f, int flags); |
|
59 |
|
|
60 |
#define TARGET_PAGE_BITS 12 |
|
61 |
#include "cpu-all.h" |
|
62 |
|
|
63 |
#endif |
b/target-arm/exec.h | ||
---|---|---|
1 |
/* |
|
2 |
* ARM execution defines |
|
3 |
* |
|
4 |
* Copyright (c) 2003 Fabrice Bellard |
|
5 |
* |
|
6 |
* This library is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU Lesser General Public |
|
8 |
* License as published by the Free Software Foundation; either |
|
9 |
* version 2 of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This library is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 |
* Lesser General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU Lesser General Public |
|
17 |
* License along with this library; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
19 |
*/ |
|
20 |
#include "dyngen-exec.h" |
|
21 |
|
|
22 |
register struct CPUARMState *env asm(AREG0); |
|
23 |
register uint32_t T0 asm(AREG1); |
|
24 |
register uint32_t T1 asm(AREG2); |
|
25 |
register uint32_t T2 asm(AREG3); |
|
26 |
|
|
27 |
#include "cpu.h" |
|
28 |
#include "exec-all.h" |
|
29 |
|
|
30 |
void cpu_lock(void); |
|
31 |
void cpu_unlock(void); |
|
32 |
void cpu_loop_exit(void); |
|
33 |
|
|
34 |
static inline int compute_cpsr(void) |
|
35 |
{ |
|
36 |
int ZF; |
|
37 |
ZF = (env->NZF == 0); |
|
38 |
return env->cpsr | (env->NZF & 0x80000000) | (ZF << 30) | |
|
39 |
(env->CF << 29) | ((env->VF & 0x80000000) >> 3); |
|
40 |
} |
b/target-arm/op.c | ||
---|---|---|
1 |
/* |
|
2 |
* ARM micro operations |
|
3 |
* |
|
4 |
* Copyright (c) 2003 Fabrice Bellard |
|
5 |
* |
|
6 |
* This library is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU Lesser General Public |
|
8 |
* License as published by the Free Software Foundation; either |
|
9 |
* version 2 of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This library is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 |
* Lesser General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU Lesser General Public |
|
17 |
* License along with this library; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
19 |
*/ |
|
20 |
#include "exec.h" |
|
21 |
|
|
22 |
#define REGNAME r0 |
|
23 |
#define REG (env->regs[0]) |
|
24 |
#include "op_template.h" |
|
25 |
|
|
26 |
#define REGNAME r1 |
|
27 |
#define REG (env->regs[1]) |
|
28 |
#include "op_template.h" |
|
29 |
|
|
30 |
#define REGNAME r2 |
|
31 |
#define REG (env->regs[2]) |
|
32 |
#include "op_template.h" |
|
33 |
|
|
34 |
#define REGNAME r3 |
|
35 |
#define REG (env->regs[3]) |
|
36 |
#include "op_template.h" |
|
37 |
|
|
38 |
#define REGNAME r4 |
|
39 |
#define REG (env->regs[4]) |
|
40 |
#include "op_template.h" |
|
41 |
|
|
42 |
#define REGNAME r5 |
|
43 |
#define REG (env->regs[5]) |
|
44 |
#include "op_template.h" |
|
45 |
|
|
46 |
#define REGNAME r6 |
|
47 |
#define REG (env->regs[6]) |
|
48 |
#include "op_template.h" |
|
49 |
|
|
50 |
#define REGNAME r7 |
|
51 |
#define REG (env->regs[7]) |
|
52 |
#include "op_template.h" |
|
53 |
|
|
54 |
#define REGNAME r8 |
|
55 |
#define REG (env->regs[8]) |
|
56 |
#include "op_template.h" |
|
57 |
|
|
58 |
#define REGNAME r9 |
|
59 |
#define REG (env->regs[9]) |
|
60 |
#include "op_template.h" |
|
61 |
|
|
62 |
#define REGNAME r10 |
|
63 |
#define REG (env->regs[10]) |
|
64 |
#include "op_template.h" |
|
65 |
|
|
66 |
#define REGNAME r11 |
|
67 |
#define REG (env->regs[11]) |
|
68 |
#include "op_template.h" |
|
69 |
|
|
70 |
#define REGNAME r12 |
|
71 |
#define REG (env->regs[12]) |
|
72 |
#include "op_template.h" |
|
73 |
|
|
74 |
#define REGNAME r13 |
|
75 |
#define REG (env->regs[13]) |
|
76 |
#include "op_template.h" |
|
77 |
|
|
78 |
#define REGNAME r14 |
|
79 |
#define REG (env->regs[14]) |
|
80 |
#include "op_template.h" |
|
81 |
|
|
82 |
#define REGNAME r15 |
|
83 |
#define REG (env->regs[15]) |
|
84 |
#include "op_template.h" |
|
85 |
|
|
86 |
void OPPROTO op_movl_T0_0(void) |
|
87 |
{ |
|
88 |
T0 = 0; |
|
89 |
} |
|
90 |
|
|
91 |
void OPPROTO op_movl_T0_im(void) |
|
92 |
{ |
|
93 |
T0 = PARAM1; |
|
94 |
} |
|
95 |
|
|
96 |
void OPPROTO op_movl_T1_im(void) |
|
97 |
{ |
|
98 |
T1 = PARAM1; |
|
99 |
} |
|
100 |
|
|
101 |
void OPPROTO op_movl_T2_im(void) |
|
102 |
{ |
|
103 |
T2 = PARAM1; |
|
104 |
} |
|
105 |
|
|
106 |
void OPPROTO op_addl_T1_im(void) |
|
107 |
{ |
|
108 |
T1 += PARAM1; |
|
109 |
} |
|
110 |
|
|
111 |
void OPPROTO op_addl_T1_T2(void) |
|
112 |
{ |
|
113 |
T1 += T2; |
|
114 |
} |
|
115 |
|
|
116 |
void OPPROTO op_subl_T1_T2(void) |
|
117 |
{ |
|
118 |
T1 -= T2; |
|
119 |
} |
|
120 |
|
|
121 |
void OPPROTO op_addl_T0_T1(void) |
|
122 |
{ |
|
123 |
T0 += T1; |
|
124 |
} |
|
125 |
|
|
126 |
void OPPROTO op_addl_T0_T1_cc(void) |
|
127 |
{ |
|
128 |
unsigned int src1; |
|
129 |
src1 = T0; |
|
130 |
T0 += T1; |
|
131 |
env->NZF = T0; |
|
132 |
env->CF = T0 < src1; |
|
133 |
env->VF = (src1 ^ T1 ^ -1) & (src1 ^ T0); |
|
134 |
} |
|
135 |
|
|
136 |
void OPPROTO op_adcl_T0_T1(void) |
|
137 |
{ |
|
138 |
T0 += T1 + env->CF; |
|
139 |
} |
|
140 |
|
|
141 |
void OPPROTO op_adcl_T0_T1_cc(void) |
|
142 |
{ |
|
143 |
unsigned int src1; |
|
144 |
src1 = T0; |
|
145 |
if (!env->CF) { |
|
146 |
T0 += T1; |
|
147 |
env->CF = T0 < src1; |
|
148 |
} else { |
|
149 |
T0 += T1 + 1; |
|
150 |
env->CF = T0 <= src1; |
|
151 |
} |
|
152 |
env->VF = (src1 ^ T1 ^ -1) & (src1 ^ T0); |
|
153 |
env->NZF = T0; |
|
154 |
FORCE_RET(); |
|
155 |
} |
|
156 |
|
|
157 |
#define OPSUB(sub, sbc, res, T0, T1) \ |
|
158 |
\ |
|
159 |
void OPPROTO op_ ## sub ## l_T0_T1(void) \ |
|
160 |
{ \ |
|
161 |
res = T0 - T1; \ |
|
162 |
} \ |
|
163 |
\ |
|
164 |
void OPPROTO op_ ## sub ## l_T0_T1_cc(void) \ |
|
165 |
{ \ |
|
166 |
unsigned int src1; \ |
|
167 |
src1 = T0; \ |
|
168 |
T0 -= T1; \ |
|
169 |
env->NZF = T0; \ |
|
170 |
env->CF = src1 >= T1; \ |
|
171 |
env->VF = (src1 ^ T1) & (src1 ^ T0); \ |
|
172 |
res = T0; \ |
|
173 |
} \ |
|
174 |
\ |
|
175 |
void OPPROTO op_ ## sbc ## l_T0_T1(void) \ |
|
176 |
{ \ |
|
177 |
res = T0 - T1 + env->CF - 1; \ |
|
178 |
} \ |
|
179 |
\ |
|
180 |
void OPPROTO op_ ## sbc ## l_T0_T1_cc(void) \ |
|
181 |
{ \ |
|
182 |
unsigned int src1; \ |
|
183 |
src1 = T0; \ |
|
184 |
if (!env->CF) { \ |
|
185 |
T0 = T0 - T1 - 1; \ |
|
186 |
env->CF = src1 >= T1; \ |
|
187 |
} else { \ |
|
188 |
T0 = T0 - T1; \ |
|
189 |
env->CF = src1 > T1; \ |
|
190 |
} \ |
|
191 |
env->VF = (src1 ^ T1) & (src1 ^ T0); \ |
|
192 |
env->NZF = T0; \ |
|
193 |
res = T0; \ |
|
194 |
FORCE_RET(); \ |
|
195 |
} |
|
196 |
|
|
197 |
OPSUB(sub, sbc, T0, T0, T1) |
|
198 |
|
|
199 |
OPSUB(rsb, rsc, T0, T1, T0) |
|
200 |
|
|
201 |
void OPPROTO op_andl_T0_T1(void) |
|
202 |
{ |
|
203 |
T0 &= T1; |
|
204 |
} |
|
205 |
|
|
206 |
void OPPROTO op_xorl_T0_T1(void) |
|
207 |
{ |
|
208 |
T0 ^= T1; |
|
209 |
} |
|
210 |
|
|
211 |
void OPPROTO op_orl_T0_T1(void) |
|
212 |
{ |
|
213 |
T0 |= T1; |
|
214 |
} |
|
215 |
|
|
216 |
void OPPROTO op_bicl_T0_T1(void) |
|
217 |
{ |
|
218 |
T0 &= ~T1; |
|
219 |
} |
|
220 |
|
|
221 |
void OPPROTO op_notl_T1(void) |
|
222 |
{ |
|
223 |
T1 = ~T1; |
|
224 |
} |
|
225 |
|
|
226 |
void OPPROTO op_logic_T0_cc(void) |
|
227 |
{ |
|
228 |
env->NZF = T0; |
|
229 |
} |
|
230 |
|
|
231 |
void OPPROTO op_logic_T1_cc(void) |
|
232 |
{ |
|
233 |
env->NZF = T1; |
|
234 |
} |
|
235 |
|
|
236 |
#define EIP (env->regs[15]) |
|
237 |
|
|
238 |
void OPPROTO op_test_eq(void) |
|
239 |
{ |
|
240 |
if (env->NZF == 0) |
|
241 |
JUMP_TB(op_test_eq, PARAM1, 0, PARAM2); |
|
242 |
FORCE_RET(); |
|
243 |
} |
|
244 |
|
|
245 |
void OPPROTO op_test_ne(void) |
|
246 |
{ |
|
247 |
if (env->NZF != 0) |
|
248 |
JUMP_TB(op_test_ne, PARAM1, 0, PARAM2); |
|
249 |
FORCE_RET(); |
|
250 |
} |
|
251 |
|
|
252 |
void OPPROTO op_test_cs(void) |
|
253 |
{ |
|
254 |
if (env->CF != 0) |
|
255 |
JUMP_TB(op_test_cs, PARAM1, 0, PARAM2); |
|
256 |
FORCE_RET(); |
|
257 |
} |
|
258 |
|
|
259 |
void OPPROTO op_test_cc(void) |
|
260 |
{ |
|
261 |
if (env->CF == 0) |
|
262 |
JUMP_TB(op_test_cc, PARAM1, 0, PARAM2); |
|
263 |
FORCE_RET(); |
|
264 |
} |
|
265 |
|
|
266 |
void OPPROTO op_test_mi(void) |
|
267 |
{ |
|
268 |
if ((env->NZF & 0x80000000) != 0) |
|
269 |
JUMP_TB(op_test_mi, PARAM1, 0, PARAM2); |
|
270 |
FORCE_RET(); |
|
271 |
} |
|
272 |
|
|
273 |
void OPPROTO op_test_pl(void) |
|
274 |
{ |
|
275 |
if ((env->NZF & 0x80000000) == 0) |
|
276 |
JUMP_TB(op_test_pl, PARAM1, 0, PARAM2); |
|
277 |
FORCE_RET(); |
|
278 |
} |
|
279 |
|
|
280 |
void OPPROTO op_test_vs(void) |
|
281 |
{ |
|
282 |
if ((env->VF & 0x80000000) != 0) |
|
283 |
JUMP_TB(op_test_vs, PARAM1, 0, PARAM2); |
|
284 |
FORCE_RET(); |
|
285 |
} |
|
286 |
|
|
287 |
void OPPROTO op_test_vc(void) |
|
288 |
{ |
|
289 |
if ((env->VF & 0x80000000) == 0) |
|
290 |
JUMP_TB(op_test_vc, PARAM1, 0, PARAM2); |
|
291 |
FORCE_RET(); |
|
292 |
} |
|
293 |
|
|
294 |
void OPPROTO op_test_hi(void) |
|
295 |
{ |
|
296 |
if (env->CF != 0 && env->NZF != 0) |
|
297 |
JUMP_TB(op_test_hi, PARAM1, 0, PARAM2); |
|
298 |
FORCE_RET(); |
|
299 |
} |
|
300 |
|
|
301 |
void OPPROTO op_test_ls(void) |
|
302 |
{ |
|
303 |
if (env->CF == 0 || env->NZF == 0) |
|
304 |
JUMP_TB(op_test_ls, PARAM1, 0, PARAM2); |
|
305 |
FORCE_RET(); |
|
306 |
} |
|
307 |
|
|
308 |
void OPPROTO op_test_ge(void) |
|
309 |
{ |
|
310 |
if (((env->VF ^ env->NZF) & 0x80000000) == 0) |
|
311 |
JUMP_TB(op_test_ge, PARAM1, 0, PARAM2); |
|
312 |
FORCE_RET(); |
|
313 |
} |
|
314 |
|
|
315 |
void OPPROTO op_test_lt(void) |
|
316 |
{ |
|
317 |
if (((env->VF ^ env->NZF) & 0x80000000) != 0) |
|
318 |
JUMP_TB(op_test_lt, PARAM1, 0, PARAM2); |
|
319 |
FORCE_RET(); |
|
320 |
} |
|
321 |
|
|
322 |
void OPPROTO op_test_gt(void) |
|
323 |
{ |
|
324 |
if (env->NZF != 0 && ((env->VF ^ env->NZF) & 0x80000000) == 0) |
|
325 |
JUMP_TB(op_test_gt, PARAM1, 0, PARAM2); |
|
326 |
FORCE_RET(); |
|
327 |
} |
|
328 |
|
|
329 |
void OPPROTO op_test_le(void) |
|
330 |
{ |
|
331 |
if (env->NZF == 0 || ((env->VF ^ env->NZF) & 0x80000000) != 0) |
|
332 |
JUMP_TB(op_test_le, PARAM1, 0, PARAM2); |
|
333 |
FORCE_RET(); |
|
334 |
} |
|
335 |
|
|
336 |
void OPPROTO op_jmp(void) |
|
337 |
{ |
|
338 |
JUMP_TB(op_jmp, PARAM1, 1, PARAM2); |
|
339 |
} |
|
340 |
|
|
341 |
void OPPROTO op_exit_tb(void) |
|
342 |
{ |
|
343 |
EXIT_TB(); |
|
344 |
} |
|
345 |
|
|
346 |
void OPPROTO op_movl_T0_psr(void) |
|
347 |
{ |
|
348 |
T0 = compute_cpsr(); |
|
349 |
} |
|
350 |
|
|
351 |
/* NOTE: N = 1 and Z = 1 cannot be stored currently */ |
|
352 |
void OPPROTO op_movl_psr_T0(void) |
|
353 |
{ |
|
354 |
unsigned int psr; |
|
355 |
psr = T0; |
|
356 |
env->CF = (psr >> 29) & 1; |
|
357 |
env->NZF = (psr & 0xc0000000) ^ 0x40000000; |
|
358 |
env->VF = (psr << 3) & 0x80000000; |
|
359 |
/* for user mode we do not update other state info */ |
|
360 |
} |
|
361 |
|
|
362 |
void OPPROTO op_mul_T0_T1(void) |
|
363 |
{ |
|
364 |
T0 = T0 * T1; |
|
365 |
} |
|
366 |
|
|
367 |
/* 64 bit unsigned mul */ |
|
368 |
void OPPROTO op_mull_T0_T1(void) |
|
369 |
{ |
|
370 |
uint64_t res; |
|
371 |
res = T0 * T1; |
|
372 |
T1 = res >> 32; |
|
373 |
T0 = res; |
|
374 |
} |
|
375 |
|
|
376 |
/* 64 bit signed mul */ |
|
377 |
void OPPROTO op_imull_T0_T1(void) |
|
378 |
{ |
|
379 |
uint64_t res; |
|
380 |
res = (int32_t)T0 * (int32_t)T1; |
|
381 |
T1 = res >> 32; |
|
382 |
T0 = res; |
|
383 |
} |
|
384 |
|
|
385 |
void OPPROTO op_addq_T0_T1(void) |
|
386 |
{ |
|
387 |
uint64_t res; |
|
388 |
res = ((uint64_t)T1 << 32) | T0; |
|
389 |
res += ((uint64_t)(env->regs[PARAM2]) << 32) | (env->regs[PARAM1]); |
|
390 |
T1 = res >> 32; |
|
391 |
T0 = res; |
|
392 |
} |
|
393 |
|
|
394 |
void OPPROTO op_logicq_cc(void) |
|
395 |
{ |
|
396 |
env->NZF = (T1 & 0x80000000) | ((T0 | T1) != 0); |
|
397 |
} |
|
398 |
|
|
399 |
/* memory access */ |
|
400 |
|
|
401 |
void OPPROTO op_ldub_T0_T1(void) |
|
402 |
{ |
|
403 |
T0 = ldub((void *)T1); |
|
404 |
} |
|
405 |
|
|
406 |
void OPPROTO op_ldsb_T0_T1(void) |
|
407 |
{ |
|
408 |
T0 = ldsb((void *)T1); |
|
409 |
} |
|
410 |
|
|
411 |
void OPPROTO op_lduw_T0_T1(void) |
|
412 |
{ |
|
413 |
T0 = lduw((void *)T1); |
|
414 |
} |
|
415 |
|
|
416 |
void OPPROTO op_ldsw_T0_T1(void) |
|
417 |
{ |
|
418 |
T0 = ldsw((void *)T1); |
|
419 |
} |
|
420 |
|
|
421 |
void OPPROTO op_ldl_T0_T1(void) |
|
422 |
{ |
|
423 |
T0 = ldl((void *)T1); |
|
424 |
} |
|
425 |
|
|
426 |
void OPPROTO op_stb_T0_T1(void) |
|
427 |
{ |
|
428 |
stb((void *)T1, T0); |
|
429 |
} |
|
430 |
|
|
431 |
void OPPROTO op_stw_T0_T1(void) |
|
432 |
{ |
|
433 |
stw((void *)T1, T0); |
|
434 |
} |
|
435 |
|
|
436 |
void OPPROTO op_stl_T0_T1(void) |
|
437 |
{ |
|
438 |
stl((void *)T1, T0); |
|
439 |
} |
|
440 |
|
|
441 |
void OPPROTO op_swpb_T0_T1(void) |
|
442 |
{ |
|
443 |
int tmp; |
|
444 |
|
|
445 |
cpu_lock(); |
|
446 |
tmp = ldub((void *)T1); |
|
447 |
stb((void *)T1, T0); |
|
448 |
T0 = tmp; |
|
449 |
cpu_unlock(); |
|
450 |
} |
|
451 |
|
|
452 |
void OPPROTO op_swpl_T0_T1(void) |
|
453 |
{ |
|
454 |
int tmp; |
|
455 |
|
|
456 |
cpu_lock(); |
|
457 |
tmp = ldl((void *)T1); |
|
458 |
stl((void *)T1, T0); |
|
459 |
T0 = tmp; |
|
460 |
cpu_unlock(); |
|
461 |
} |
|
462 |
|
|
463 |
/* shifts */ |
|
464 |
|
|
465 |
/* T1 based */ |
|
466 |
void OPPROTO op_shll_T1_im(void) |
|
467 |
{ |
|
468 |
T1 = T1 << PARAM1; |
|
469 |
} |
|
470 |
|
|
471 |
void OPPROTO op_shrl_T1_im(void) |
|
472 |
{ |
|
473 |
T1 = (uint32_t)T1 >> PARAM1; |
|
474 |
} |
|
475 |
|
|
476 |
void OPPROTO op_sarl_T1_im(void) |
|
477 |
{ |
|
478 |
T1 = (int32_t)T1 >> PARAM1; |
|
479 |
} |
|
480 |
|
|
481 |
void OPPROTO op_rorl_T1_im(void) |
|
482 |
{ |
|
483 |
int shift; |
|
484 |
shift = PARAM1; |
|
485 |
T1 = ((uint32_t)T1 >> shift) | (T1 << (32 - shift)); |
|
486 |
} |
|
487 |
|
|
488 |
/* T1 based, set C flag */ |
|
489 |
void OPPROTO op_shll_T1_im_cc(void) |
|
490 |
{ |
|
491 |
env->CF = (T1 >> (32 - PARAM1)) & 1; |
|
492 |
T1 = T1 << PARAM1; |
|
493 |
} |
|
494 |
|
|
495 |
void OPPROTO op_shrl_T1_im_cc(void) |
|
496 |
{ |
|
497 |
env->CF = (T1 >> (PARAM1 - 1)) & 1; |
|
498 |
T1 = (uint32_t)T1 >> PARAM1; |
|
499 |
} |
|
500 |
|
|
501 |
void OPPROTO op_sarl_T1_im_cc(void) |
|
502 |
{ |
|
503 |
env->CF = (T1 >> (PARAM1 - 1)) & 1; |
|
504 |
T1 = (int32_t)T1 >> PARAM1; |
|
505 |
} |
|
506 |
|
|
507 |
void OPPROTO op_rorl_T1_im_cc(void) |
|
508 |
{ |
|
509 |
int shift; |
|
510 |
shift = PARAM1; |
|
511 |
env->CF = (T1 >> (shift - 1)) & 1; |
|
512 |
T1 = ((uint32_t)T1 >> shift) | (T1 << (32 - shift)); |
|
513 |
} |
|
514 |
|
|
515 |
/* T2 based */ |
|
516 |
void OPPROTO op_shll_T2_im(void) |
|
517 |
{ |
|
518 |
T2 = T2 << PARAM1; |
|
519 |
} |
|
520 |
|
|
521 |
void OPPROTO op_shrl_T2_im(void) |
|
522 |
{ |
|
523 |
T2 = (uint32_t)T2 >> PARAM1; |
|
524 |
} |
|
525 |
|
|
526 |
void OPPROTO op_sarl_T2_im(void) |
|
527 |
{ |
|
528 |
T2 = (int32_t)T2 >> PARAM1; |
|
529 |
} |
|
530 |
|
|
531 |
void OPPROTO op_rorl_T2_im(void) |
|
532 |
{ |
|
533 |
int shift; |
|
534 |
shift = PARAM1; |
|
535 |
T2 = ((uint32_t)T2 >> shift) | (T2 << (32 - shift)); |
|
536 |
} |
|
537 |
|
|
538 |
/* T1 based, use T0 as shift count */ |
|
539 |
|
|
540 |
void OPPROTO op_shll_T1_T0(void) |
|
541 |
{ |
|
542 |
int shift; |
|
543 |
shift = T0 & 0xff; |
|
544 |
if (shift >= 32) |
|
545 |
T1 = 0; |
|
546 |
else |
|
547 |
T1 = T1 << shift; |
|
548 |
FORCE_RET(); |
|
549 |
} |
|
550 |
|
|
551 |
void OPPROTO op_shrl_T1_T0(void) |
|
552 |
{ |
|
553 |
int shift; |
|
554 |
shift = T0 & 0xff; |
|
555 |
if (shift >= 32) |
|
556 |
T1 = 0; |
|
557 |
else |
|
558 |
T1 = (uint32_t)T1 >> shift; |
|
559 |
FORCE_RET(); |
|
560 |
} |
|
561 |
|
|
562 |
void OPPROTO op_sarl_T1_T0(void) |
|
563 |
{ |
|
564 |
int shift; |
|
565 |
shift = T0 & 0xff; |
Also available in: Unified diff