VirtualBox

source: vbox/trunk/src/recompiler/dyngen-exec.h@ 36887

最後變更 在這個檔案從36887是 36176,由 vboxsync 提交於 14 年 前

build fix

  • 屬性 svn:eol-style 設為 native
檔案大小: 4.3 KB
 
1/*
2 * dyngen defines for micro operation code
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, see <http://www.gnu.org/licenses/>.
18 */
19
20/*
21 * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
22 * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
23 * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
24 * a choice of LGPL license versions is made available with the language indicating
25 * that LGPLv2 or any later version may be used, or where a choice of which version
26 * of the LGPL is applied is otherwise unspecified.
27 */
28
29#if !defined(__DYNGEN_EXEC_H__)
30#define __DYNGEN_EXEC_H__
31
32#ifndef VBOX
33/* prevent Solaris from trying to typedef FILE in gcc's
34 include/floatingpoint.h which will conflict with the
35 definition down below */
36#ifdef __sun__
37#define _FILEDEFED
38#endif
39#endif /* !VBOX */
40
41/* NOTE: standard headers should be used with special care at this
42 point because host CPU registers are used as global variables. Some
43 host headers do not allow that. */
44#include <stddef.h>
45#ifndef VBOX
46#include <stdint.h>
47
48
49#ifdef __OpenBSD__
50#include <sys/types.h>
51#endif
52
53/* XXX: This may be wrong for 64-bit ILP32 hosts. */
54typedef void * host_reg_t;
55
56#ifdef HOST_BSD
57typedef struct __sFILE FILE;
58#else
59typedef struct FILE FILE;
60#endif
61extern int fprintf(FILE *, const char *, ...);
62extern int fputs(const char *, FILE *);
63extern int printf(const char *, ...);
64#undef NULL
65#define NULL 0
66
67#else /* VBOX */
68
69/* XXX: This may be wrong for 64-bit ILP32 hosts. */
70typedef void * host_reg_t;
71
72#include <iprt/stdint.h>
73#include <stdio.h>
74
75#endif /* VBOX */
76
77#if defined(__i386__)
78#ifndef VBOX
79#define AREG0 "ebp"
80#define AREG1 "ebx"
81#define AREG2 "esi"
82#else /* VBOX - why are we different? */
83# define AREG0 "esi"
84# define AREG1 "edi"
85#endif /* VBOX */
86#elif defined(__x86_64__)
87#define AREG0 "r14"
88#define AREG1 "r15"
89#define AREG2 "r12"
90#elif defined(_ARCH_PPC)
91#define AREG0 "r27"
92#define AREG1 "r24"
93#define AREG2 "r25"
94#elif defined(__arm__)
95#define AREG0 "r7"
96#define AREG1 "r4"
97#define AREG2 "r5"
98#elif defined(__hppa__)
99#define AREG0 "r17"
100#define AREG1 "r14"
101#define AREG2 "r15"
102#elif defined(__mips__)
103#define AREG0 "fp"
104#define AREG1 "s0"
105#define AREG2 "s1"
106#elif defined(__sparc__)
107#ifdef HOST_SOLARIS
108#define AREG0 "g2"
109#define AREG1 "g3"
110#define AREG2 "g4"
111#else
112#ifdef __sparc_v9__
113#define AREG0 "g5"
114#define AREG1 "g6"
115#define AREG2 "g7"
116#else
117#define AREG0 "g6"
118#define AREG1 "g1"
119#define AREG2 "g2"
120#endif
121#endif
122#elif defined(__s390__)
123#define AREG0 "r10"
124#define AREG1 "r7"
125#define AREG2 "r8"
126#elif defined(__alpha__)
127/* Note $15 is the frame pointer, so anything in op-i386.c that would
128 require a frame pointer, like alloca, would probably loose. */
129#define AREG0 "$15"
130#define AREG1 "$9"
131#define AREG2 "$10"
132#elif defined(__mc68000)
133#define AREG0 "%a5"
134#define AREG1 "%a4"
135#define AREG2 "%d7"
136#elif defined(__ia64__)
137#define AREG0 "r7"
138#define AREG1 "r4"
139#define AREG2 "r5"
140#else
141#error unsupported CPU
142#endif
143
144#define xglue(x, y) x ## y
145#define glue(x, y) xglue(x, y)
146#define stringify(s) tostring(s)
147#define tostring(s) #s
148
149/* The return address may point to the start of the next instruction.
150 Subtracting one gets us the call instruction itself. */
151#if defined(__s390__)
152# define GETPC() ((void*)(((unsigned long)__builtin_return_address(0) & 0x7fffffffUL) - 1))
153#elif defined(__arm__)
154/* Thumb return addresses have the low bit set, so we need to subtract two.
155 This is still safe in ARM mode because instructions are 4 bytes. */
156# define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 2))
157#else
158# define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 1))
159#endif
160
161#endif /* !defined(__DYNGEN_EXEC_H__) */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette