VirtualBox

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

最後變更 在這個檔案從62639是 42601,由 vboxsync 提交於 12 年 前

REM: Initial changes to make it work (seemingly) with MinGW-w64.

  • 屬性 svn:eol-style 設為 native
檔案大小: 3.8 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#ifdef __OpenBSD__
49#include <sys/types.h>
50#endif
51
52/* XXX: This may be wrong for 64-bit ILP32 hosts. */
53typedef void * host_reg_t;
54
55#ifdef CONFIG_BSD
56typedef struct __sFILE FILE;
57#else
58typedef struct FILE FILE;
59#endif
60extern int fprintf(FILE *, const char *, ...);
61extern int fputs(const char *, FILE *);
62extern int printf(const char *, ...);
63
64#else /* VBOX */
65
66/* XXX: This may be wrong for 64-bit ILP32 hosts. */
67typedef void * host_reg_t;
68
69#include <iprt/stdint.h>
70#include <stdio.h>
71
72#endif /* VBOX */
73
74#if defined(__i386__)
75# ifndef VBOX
76#define AREG0 "ebp"
77# else /* VBOX - why are we different? frame-pointer optimizations on mac? */
78# define AREG0 "esi"
79# endif /* VBOX */
80#elif defined(__x86_64__)
81#define AREG0 "r14"
82#elif defined(_ARCH_PPC)
83#define AREG0 "r27"
84#elif defined(__arm__)
85#define AREG0 "r7"
86#elif defined(__hppa__)
87#define AREG0 "r17"
88#elif defined(__mips__)
89#define AREG0 "s0"
90#elif defined(__sparc__)
91#ifdef CONFIG_SOLARIS
92#define AREG0 "g2"
93#else
94#ifdef __sparc_v9__
95#define AREG0 "g5"
96#else
97#define AREG0 "g6"
98#endif
99#endif
100#elif defined(__s390__)
101#define AREG0 "r10"
102#elif defined(__alpha__)
103/* Note $15 is the frame pointer, so anything in op-i386.c that would
104 require a frame pointer, like alloca, would probably loose. */
105#define AREG0 "$15"
106#elif defined(__mc68000)
107#define AREG0 "%a5"
108#elif defined(__ia64__)
109#define AREG0 "r7"
110#else
111#error unsupported CPU
112#endif
113
114#define xglue(x, y) x ## y
115#define glue(x, y) xglue(x, y)
116#define stringify(s) tostring(s)
117#define tostring(s) #s
118
119/* The return address may point to the start of the next instruction.
120 Subtracting one gets us the call instruction itself. */
121#if defined(__s390__) && !defined(__s390x__)
122# define GETPC() ((void*)(((uintptr_t)__builtin_return_address(0) & 0x7fffffffUL) - 1))
123#elif defined(__arm__)
124/* Thumb return addresses have the low bit set, so we need to subtract two.
125 This is still safe in ARM mode because instructions are 4 bytes. */
126# define GETPC() ((void *)((uintptr_t)__builtin_return_address(0) - 2))
127#else
128# define GETPC() ((void *)((uintptr_t)__builtin_return_address(0) - 1))
129#endif
130
131#endif /* !defined(__DYNGEN_EXEC_H__) */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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