VirtualBox

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

Last change on this file since 68389 was 37675, checked in by vboxsync, 13 years ago

rem: Synced with v0.12.5.

  • Property svn:eol-style set to native
File size: 2.3 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, 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/* The GCC global register variable extension is used to reserve some
30 host registers for use by generated code. However only the core parts of
31 the translation engine are compiled with these settings. We must manually
32 save/restore these registers when called from regular code.
33 It is not sufficient to save/restore T0 et. al. as these may be declared
34 with a datatype smaller than the actual register. */
35
36#if defined(DECLARE_HOST_REGS)
37
38#define DO_REG(REG) \
39 register host_reg_t reg_AREG##REG asm(AREG##REG); \
40 volatile host_reg_t saved_AREG##REG;
41
42#elif defined(SAVE_HOST_REGS)
43
44#define DO_REG(REG) \
45 __asm__ __volatile__ ("" : "=r" (reg_AREG##REG)); \
46 saved_AREG##REG = reg_AREG##REG;
47
48#else
49
50#define DO_REG(REG) \
51 reg_AREG##REG = saved_AREG##REG; \
52 __asm__ __volatile__ ("" : : "r" (reg_AREG##REG));
53
54#endif
55
56#ifdef AREG0
57DO_REG(0)
58#endif
59
60#ifdef AREG1
61DO_REG(1)
62#endif
63
64#ifdef AREG2
65DO_REG(2)
66#endif
67
68#undef SAVE_HOST_REGS
69#undef DECLARE_HOST_REGS
70#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