Changeset 36140 in vbox for trunk/src/recompiler/dyngen-exec.h
- Timestamp:
- Mar 3, 2011 1:48:16 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/recompiler/dyngen-exec.h
r33656 r36140 47 47 #ifndef VBOX 48 48 49 #ifdef __OpenBSD__ 50 #include <sys/types.h> 51 #else 49 52 typedef unsigned char uint8_t; 50 53 typedef unsigned short uint16_t; 51 54 typedef unsigned int uint32_t; 52 / * Linux/Sparc64 defines uint64_t */53 #if !(defined (__sparc_v9__) && defined(__linux__)) 55 // Linux/Sparc64 defines uint64_t 56 #if !(defined (__sparc_v9__) && defined(__linux__)) && !(defined(__APPLE__) && defined(__x86_64__)) 54 57 /* XXX may be done for all 64 bits targets ? */ 55 #if defined (__x86_64__) || defined(__ia64) 58 #if defined (__x86_64__) || defined(__ia64) || defined(__s390x__) || defined(__alpha__) || defined(__powerpc64__) 56 59 typedef unsigned long uint64_t; 57 60 #else … … 61 64 62 65 /* if Solaris/__sun__, don't typedef int8_t, as it will be typedef'd 63 prior to this and will cause an error in comp ilation, conflicting66 prior to this and will cause an error in compliation, conflicting 64 67 with /usr/include/sys/int_types.h, line 75 */ 65 68 #ifndef __sun__ … … 69 72 typedef signed int int32_t; 70 73 // Linux/Sparc64 defines int64_t 71 #if !(defined (__sparc_v9__) && defined(__linux__)) 72 #if defined (__x86_64__) || defined(__ia64) 74 #if !(defined (__sparc_v9__) && defined(__linux__)) && !(defined(__APPLE__) && defined(__x86_64__)) 75 #if defined (__x86_64__) || defined(__ia64) || defined(__s390x__) || defined(__alpha__) || defined(__powerpc64__) 73 76 typedef signed long int64_t; 74 77 #else 75 78 typedef signed long long int64_t; 79 #endif 76 80 #endif 77 81 #endif … … 114 118 #endif /* VBOX */ 115 119 116 #if def __i386__120 #if defined(__i386__) 117 121 #ifndef VBOX 118 122 #define AREG0 "ebp" … … 120 124 #define AREG2 "esi" 121 125 #define AREG3 "edi" 122 #else 123 #define AREG0 "esi" 124 #define AREG1 "edi" 125 #endif 126 #endif 127 #ifdef __x86_64__ 128 #if defined(VBOX) 129 /* Must be in sync with TCG register notion, see tcg-target.h */ 130 #endif 126 #else /* VBOX - why are we different? */ 127 # define AREG0 "esi" 128 # define AREG1 "edi" 129 #endif /* VBOX */ 130 #elif defined(__x86_64__) 131 131 #define AREG0 "r14" 132 132 #define AREG1 "r15" 133 133 #define AREG2 "r12" 134 134 #define AREG3 "r13" 135 #endif 136 #ifdef __powerpc__ 135 //#define AREG4 "rbp" 136 //#define AREG5 "rbx" 137 #elif defined(__powerpc__) 137 138 #define AREG0 "r27" 138 139 #define AREG1 "r24" … … 150 151 #define AREG11 "r23" 151 152 #endif 152 #define USE_INT_TO_FLOAT_HELPERS 153 #define BUGGY_GCC_DIV64 154 #endif 155 #ifdef __arm__ 153 #elif defined(__arm__) 156 154 #define AREG0 "r7" 157 155 #define AREG1 "r4" 158 156 #define AREG2 "r5" 159 157 #define AREG3 "r6" 160 #endif 161 #ifdef __mips__ 162 #define AREG0 "s3" 158 #elif defined(__hppa__) 159 #define AREG0 "r17" 160 #define AREG1 "r14" 161 #define AREG2 "r15" 162 #define AREG3 "r16" 163 #elif defined(__mips__) 164 #define AREG0 "fp" 163 165 #define AREG1 "s0" 164 166 #define AREG2 "s1" 165 167 #define AREG3 "s2" 166 #endif 167 #ifdef __sparc__ 168 #define AREG4 "s3" 169 #define AREG5 "s4" 170 #define AREG6 "s5" 171 #define AREG7 "s6" 172 #define AREG8 "s7" 173 #elif defined(__sparc__) 168 174 #ifdef HOST_SOLARIS 169 175 #define AREG0 "g2" … … 174 180 #else 175 181 #ifdef __sparc_v9__ 176 #define AREG0 "g1" 177 #define AREG1 "g4" 178 #define AREG2 "g5" 179 #define AREG3 "g7" 182 #define AREG0 "g5" 183 #define AREG1 "g6" 184 #define AREG2 "g7" 180 185 #else 181 186 #define AREG0 "g6" … … 193 198 #endif 194 199 #endif 195 #define USE_FP_CONVERT 196 #endif 197 #ifdef __s390__ 200 #elif defined(__s390__) 198 201 #define AREG0 "r10" 199 202 #define AREG1 "r7" 200 203 #define AREG2 "r8" 201 204 #define AREG3 "r9" 202 #endif 203 #ifdef __alpha__ 205 #elif defined(__alpha__) 204 206 /* Note $15 is the frame pointer, so anything in op-i386.c that would 205 207 require a frame pointer, like alloca, would probably loose. */ … … 211 213 #define AREG5 "$13" 212 214 #define AREG6 "$14" 213 #endif 214 #ifdef __mc68000 215 #elif defined(__mc68000) 215 216 #define AREG0 "%a5" 216 217 #define AREG1 "%a4" … … 218 219 #define AREG3 "%d6" 219 220 #define AREG4 "%d5" 220 #endif 221 #ifdef __ia64__ 221 #elif defined(__ia64__) 222 222 #define AREG0 "r7" 223 223 #define AREG1 "r4" 224 224 #define AREG2 "r5" 225 225 #define AREG3 "r6" 226 #endif 227 228 #ifndef VBOX 226 #else 227 #error unsupported CPU 228 #endif 229 230 #ifndef VBOX /* WHY DO WE UNSUBSCRIBE TO THIS MACRO? */ 229 231 /* force GCC to generate only one epilog at the end of the function */ 230 232 #define FORCE_RET() __asm__ __volatile__("" : : : "memory"); … … 259 261 #define PARAM2 ({ int _r; asm("" : "=r"(_r) : "0" (&__op_param2)); _r; }) 260 262 #define PARAM3 ({ int _r; asm("" : "=r"(_r) : "0" (&__op_param3)); _r; }) 263 #elif defined(__s390__) 264 extern int __op_param1 __hidden; 265 extern int __op_param2 __hidden; 266 extern int __op_param3 __hidden; 267 #define PARAM1 ({ int _r; asm("bras %0,8; .long " ASM_NAME(__op_param1) "; l %0,0(%0)" : "=r"(_r) : ); _r; }) 268 #define PARAM2 ({ int _r; asm("bras %0,8; .long " ASM_NAME(__op_param2) "; l %0,0(%0)" : "=r"(_r) : ); _r; }) 269 #define PARAM3 ({ int _r; asm("bras %0,8; .long " ASM_NAME(__op_param3) "; l %0,0(%0)" : "=r"(_r) : ); _r; }) 261 270 #else 262 271 #if defined(__APPLE__) … … 278 287 #endif 279 288 280 #ifdef VBOX 281 #define GETPC() ASMReturnAddress() 289 #if defined(__i386__) 290 #define EXIT_TB() asm volatile ("ret") 291 #define GOTO_LABEL_PARAM(n) asm volatile ("jmp " ASM_NAME(__op_gen_label) #n) 292 #elif defined(__x86_64__) 293 #define EXIT_TB() asm volatile ("ret") 294 #define GOTO_LABEL_PARAM(n) asm volatile ("jmp " ASM_NAME(__op_gen_label) #n) 295 #elif defined(__powerpc__) 296 #define EXIT_TB() asm volatile ("blr") 297 #define GOTO_LABEL_PARAM(n) asm volatile ("b " ASM_NAME(__op_gen_label) #n) 282 298 #elif defined(__s390__) 299 #define EXIT_TB() asm volatile ("br %r14") 300 #define GOTO_LABEL_PARAM(n) asm volatile ("larl %r7,12; l %r7,0(%r7); br %r7; .long " ASM_NAME(__op_gen_label) #n) 301 #elif defined(__alpha__) 302 #define EXIT_TB() asm volatile ("ret") 303 #elif defined(__ia64__) 304 #define EXIT_TB() asm volatile ("br.ret.sptk.many b0;;") 305 #define GOTO_LABEL_PARAM(n) asm volatile ("br.sptk.many " \ 306 ASM_NAME(__op_gen_label) #n) 307 #elif defined(__sparc__) 308 #define EXIT_TB() asm volatile ("jmpl %i0 + 8, %g0; nop") 309 #define GOTO_LABEL_PARAM(n) asm volatile ("ba " ASM_NAME(__op_gen_label) #n ";nop") 310 #elif defined(__arm__) 311 #define EXIT_TB() asm volatile ("b exec_loop") 312 #define GOTO_LABEL_PARAM(n) asm volatile ("b " ASM_NAME(__op_gen_label) #n) 313 #elif defined(__mc68000) 314 #define EXIT_TB() asm volatile ("rts") 315 #elif defined(__mips__) 316 #define EXIT_TB() asm volatile ("jr $ra") 317 #define GOTO_LABEL_PARAM(n) asm volatile (".set noat; la $1, " ASM_NAME(__op_gen_label) #n "; jr $1; .set at") 318 #elif defined(__hppa__) 319 #define GOTO_LABEL_PARAM(n) asm volatile ("b,n " ASM_NAME(__op_gen_label) #n) 320 #else 321 #error unsupported CPU 322 #endif 323 283 324 /* The return address may point to the start of the next instruction. 284 325 Subtracting one gets us the call instruction itself. */ 326 #if defined(__s390__) 285 327 # define GETPC() ((void*)(((unsigned long)__builtin_return_address(0) & 0x7fffffffUL) - 1)) 286 328 #elif defined(__arm__) … … 291 333 # define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 1)) 292 334 #endif 335 293 336 #endif /* !defined(__DYNGEN_EXEC_H__) */
Note:
See TracChangeset
for help on using the changeset viewer.