VirtualBox

source: vbox/trunk/src/recompiler_new/hostregs_helper.h@ 13168

最後變更 在這個檔案從13168是 11982,由 vboxsync 提交於 16 年 前

All: license header changes for 2.0 (OSE headers, add Sun GPL/LGPL disclaimer)

檔案大小: 2.6 KB
 
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/*
22 * Sun 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, Sun 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 vairable 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#define DO_REG(REG) \
40 register host_reg_t reg_AREG##REG asm(AREG##REG); \
41 volatile host_reg_t saved_AREG##REG;
42
43#elif defined(SAVE_HOST_REGS)
44
45#define DO_REG(REG) \
46 __asm__ __volatile__ ("" : "=r" (reg_AREG##REG)); \
47 saved_AREG##REG = reg_AREG##REG;
48
49#else
50
51#define DO_REG(REG) \
52 reg_AREG##REG = saved_AREG##REG; \
53 __asm__ __volatile__ ("" : : "r" (reg_AREG##REG));
54
55#endif
56
57#ifdef AREG0
58DO_REG(0)
59#endif
60
61#ifdef AREG1
62DO_REG(1)
63#endif
64
65#ifdef AREG2
66DO_REG(2)
67#endif
68
69#ifdef AREG3
70DO_REG(3)
71#endif
72
73#ifdef AREG4
74DO_REG(4)
75#endif
76
77#ifdef AREG5
78DO_REG(5)
79#endif
80
81#ifdef AREG6
82DO_REG(6)
83#endif
84
85#ifdef AREG7
86DO_REG(7)
87#endif
88
89#ifdef AREG8
90DO_REG(8)
91#endif
92
93#ifdef AREG9
94DO_REG(9)
95#endif
96
97#ifdef AREG10
98DO_REG(10)
99#endif
100
101#ifdef AREG11
102DO_REG(11)
103#endif
104
105#undef SAVE_HOST_REGS
106#undef DECLARE_HOST_REGS
107#undef DO_REG
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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