Fix the size of the property fields.
[qemu/navara.git] / dyngen-exec.h
blob4672550649067051d37a300e2195d17ecee92d6c
1 /*
2 * dyngen defines for micro operation code
4 * Copyright (c) 2003 Fabrice Bellard
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.
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.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 #if !defined(__DYNGEN_EXEC_H__)
20 #define __DYNGEN_EXEC_H__
22 /* prevent Solaris from trying to typedef FILE in gcc's
23 include/floatingpoint.h which will conflict with the
24 definition down below */
25 #ifdef __sun__
26 #define _FILEDEFED
27 #endif
29 /* NOTE: standard headers should be used with special care at this
30 point because host CPU registers are used as global variables. Some
31 host headers do not allow that. */
32 #include <stddef.h>
33 #include <stdint.h>
35 #ifdef __OpenBSD__
36 #include <sys/types.h>
37 #endif
39 /* XXX: This may be wrong for 64-bit ILP32 hosts. */
40 typedef void * host_reg_t;
42 #ifdef CONFIG_BSD
43 typedef struct __sFILE FILE;
44 #else
45 typedef struct FILE FILE;
46 #endif
47 extern int fprintf(FILE *, const char *, ...);
48 extern int fputs(const char *, FILE *);
49 extern int printf(const char *, ...);
50 #undef NULL
51 #define NULL 0
53 #if defined(__i386__)
54 #define AREG0 "ebp"
55 #elif defined(__x86_64__)
56 #define AREG0 "r14"
57 #elif defined(_ARCH_PPC)
58 #define AREG0 "r27"
59 #elif defined(__arm__)
60 #define AREG0 "r7"
61 #elif defined(__hppa__)
62 #define AREG0 "r17"
63 #elif defined(__mips__)
64 #define AREG0 "fp"
65 #elif defined(__sparc__)
66 #ifdef CONFIG_SOLARIS
67 #define AREG0 "g2"
68 #else
69 #ifdef __sparc_v9__
70 #define AREG0 "g5"
71 #else
72 #define AREG0 "g6"
73 #endif
74 #endif
75 #elif defined(__s390__)
76 #define AREG0 "r10"
77 #elif defined(__alpha__)
78 /* Note $15 is the frame pointer, so anything in op-i386.c that would
79 require a frame pointer, like alloca, would probably loose. */
80 #define AREG0 "$15"
81 #elif defined(__mc68000)
82 #define AREG0 "%a5"
83 #elif defined(__ia64__)
84 #define AREG0 "r7"
85 #else
86 #error unsupported CPU
87 #endif
89 #define xglue(x, y) x ## y
90 #define glue(x, y) xglue(x, y)
91 #define stringify(s) tostring(s)
92 #define tostring(s) #s
94 /* The return address may point to the start of the next instruction.
95 Subtracting one gets us the call instruction itself. */
96 #if defined(__s390__)
97 # define GETPC() ((void*)(((uintptr_t)__builtin_return_address(0) & 0x7fffffffUL) - 1))
98 #elif defined(__arm__)
99 /* Thumb return addresses have the low bit set, so we need to subtract two.
100 This is still safe in ARM mode because instructions are 4 bytes. */
101 # define GETPC() ((void *)((uintptr_t)__builtin_return_address(0) - 2))
102 #else
103 # define GETPC() ((void *)((uintptr_t)__builtin_return_address(0) - 1))
104 #endif
106 #endif /* !defined(__DYNGEN_EXEC_H__) */