VirtualBox

source: vbox/trunk/src/recompiler/hostregs_helper.h@ 35048

Last change on this file since 35048 was 33656, checked in by vboxsync, 14 years ago

*: rebrand Sun (L)GPL disclaimers

  • Property svn:eol-style set to native
File size: 3.1 KB
Line 
1/*
2 * Save/restore host registers.
3 *
4 * Copyright (c) 2007 CodeSourcery
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
21/*
22 * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
23 * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
24 * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
25 * a choice of LGPL license versions is made available with the language indicating
26 * that LGPLv2 or any later version may be used, or where a choice of which version
27 * of the LGPL is applied is otherwise unspecified.
28 */
29
30/* The GCC global register variable extension is used to reserve some
31 host registers for use by dyngen. However only the core parts of the
32 translation engine are compiled with these settings. We must manually
33 save/restore these registers when called from regular code.
34 It is not sufficient to save/restore T0 et. al. as these may be declared
35 with a datatype smaller than the actual register. */
36
37#if defined(DECLARE_HOST_REGS)
38
39#ifndef VBOX
40#define DO_REG(REG) \
41 register host_reg_t reg_AREG##REG asm(AREG##REG); \
42 volatile host_reg_t saved_AREG##REG;
43#else
44#define DO_REG(REG) \
45 REGISTER_BOUND_GLOBAL(host_reg_t, reg_AREG##REG, AREG##REG); \
46 volatile host_reg_t saved_AREG##REG;
47#endif
48
49#elif defined(SAVE_HOST_REGS)
50
51#ifndef VBOX
52#define DO_REG(REG) \
53 __asm__ __volatile__ ("" : "=r" (reg_AREG##REG)); \
54 saved_AREG##REG = reg_AREG##REG;
55#else /* VBOX */
56#define DO_REG(REG) \
57 SAVE_GLOBAL_REGISTER(REG, reg_AREG##REG); \
58 saved_AREG##REG = reg_AREG##REG;
59#endif /* VBOX */
60
61#else
62
63#ifndef VBOX
64#define DO_REG(REG) \
65 reg_AREG##REG = saved_AREG##REG; \
66 __asm__ __volatile__ ("" : : "r" (reg_AREG##REG));
67#else /* VBOX */
68#define DO_REG(REG) \
69 reg_AREG##REG = saved_AREG##REG; \
70 RESTORE_GLOBAL_REGISTER(REG, reg_AREG##REG);
71#endif
72
73#endif
74
75#ifdef AREG0
76DO_REG(0)
77#endif
78
79#ifdef AREG1
80DO_REG(1)
81#endif
82
83#ifdef AREG2
84DO_REG(2)
85#endif
86
87#ifdef AREG3
88DO_REG(3)
89#endif
90
91#ifdef AREG4
92DO_REG(4)
93#endif
94
95#ifdef AREG5
96DO_REG(5)
97#endif
98
99#ifdef AREG6
100DO_REG(6)
101#endif
102
103#ifdef AREG7
104DO_REG(7)
105#endif
106
107#ifdef AREG8
108DO_REG(8)
109#endif
110
111#ifdef AREG9
112DO_REG(9)
113#endif
114
115#ifdef AREG10
116DO_REG(10)
117#endif
118
119#ifdef AREG11
120DO_REG(11)
121#endif
122
123#undef SAVE_HOST_REGS
124#undef DECLARE_HOST_REGS
125#undef DO_REG
Note: See TracBrowser for help on using the repository browser.

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