VirtualBox

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

Last change on this file since 4895 was 2422, checked in by vboxsync, 18 years ago

Removed the old recompiler code.

File size: 2.1 KB
Line 
1/*
2 * Save/restore host registrs.
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/* The GCC global register vairable extension is used to reserve some
22 host registers for use by dyngen. However only the core parts of the
23 translation engine are compiled with these settings. We must manually
24 save/restore these registers when called from regular code.
25 It is not sufficient to save/restore T0 et. al. as these may be declared
26 with a datatype smaller than the actual register. */
27
28#if defined(DECLARE_HOST_REGS)
29
30#define DO_REG(REG) \
31 register host_reg_t reg_AREG##REG asm(AREG##REG); \
32 volatile host_reg_t saved_AREG##REG;
33
34#elif defined(SAVE_HOST_REGS)
35
36#define DO_REG(REG) \
37 __asm__ __volatile__ ("" : "=r" (reg_AREG##REG)); \
38 saved_AREG##REG = reg_AREG##REG;
39
40#else
41
42#define DO_REG(REG) \
43 reg_AREG##REG = saved_AREG##REG; \
44 __asm__ __volatile__ ("" : : "r" (reg_AREG##REG));
45
46#endif
47
48#ifdef AREG0
49DO_REG(0)
50#endif
51
52#ifdef AREG1
53DO_REG(1)
54#endif
55
56#ifdef AREG2
57DO_REG(2)
58#endif
59
60#ifdef AREG3
61DO_REG(3)
62#endif
63
64#ifdef AREG4
65DO_REG(4)
66#endif
67
68#ifdef AREG5
69DO_REG(5)
70#endif
71
72#ifdef AREG6
73DO_REG(6)
74#endif
75
76#ifdef AREG7
77DO_REG(7)
78#endif
79
80#ifdef AREG8
81DO_REG(8)
82#endif
83
84#ifdef AREG9
85DO_REG(9)
86#endif
87
88#ifdef AREG10
89DO_REG(10)
90#endif
91
92#ifdef AREG11
93DO_REG(11)
94#endif
95
96#undef SAVE_HOST_REGS
97#undef DECLARE_HOST_REGS
98#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