Statistics
| Branch: | Revision:

root / tcg / sparc / tcg-target.h @ 53cd9273

History | View | Annotate | Download (2.9 kB)

1 8289b279 blueswir1
/*
2 8289b279 blueswir1
 * Tiny Code Generator for QEMU
3 8289b279 blueswir1
 *
4 8289b279 blueswir1
 * Copyright (c) 2008 Fabrice Bellard
5 8289b279 blueswir1
 *
6 8289b279 blueswir1
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 8289b279 blueswir1
 * of this software and associated documentation files (the "Software"), to deal
8 8289b279 blueswir1
 * in the Software without restriction, including without limitation the rights
9 8289b279 blueswir1
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 8289b279 blueswir1
 * copies of the Software, and to permit persons to whom the Software is
11 8289b279 blueswir1
 * furnished to do so, subject to the following conditions:
12 8289b279 blueswir1
 *
13 8289b279 blueswir1
 * The above copyright notice and this permission notice shall be included in
14 8289b279 blueswir1
 * all copies or substantial portions of the Software.
15 8289b279 blueswir1
 *
16 8289b279 blueswir1
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 8289b279 blueswir1
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 8289b279 blueswir1
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 8289b279 blueswir1
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 8289b279 blueswir1
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 8289b279 blueswir1
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 8289b279 blueswir1
 * THE SOFTWARE.
23 8289b279 blueswir1
 */
24 8289b279 blueswir1
#define TCG_TARGET_SPARC 1
25 8289b279 blueswir1
26 8289b279 blueswir1
#if defined(__sparc_v9__) && !defined(__sparc_v8plus__)
27 8289b279 blueswir1
#define TCG_TARGET_REG_BITS 64
28 8289b279 blueswir1
#else
29 8289b279 blueswir1
#define TCG_TARGET_REG_BITS 32
30 8289b279 blueswir1
#endif
31 8289b279 blueswir1
32 8289b279 blueswir1
#define TCG_TARGET_WORDS_BIGENDIAN
33 8289b279 blueswir1
34 8289b279 blueswir1
#define TCG_TARGET_NB_REGS 32
35 8289b279 blueswir1
36 8289b279 blueswir1
enum {
37 8289b279 blueswir1
    TCG_REG_G0 = 0,
38 8289b279 blueswir1
    TCG_REG_G1,
39 8289b279 blueswir1
    TCG_REG_G2,
40 8289b279 blueswir1
    TCG_REG_G3,
41 8289b279 blueswir1
    TCG_REG_G4,
42 8289b279 blueswir1
    TCG_REG_G5,
43 8289b279 blueswir1
    TCG_REG_G6,
44 8289b279 blueswir1
    TCG_REG_G7,
45 8289b279 blueswir1
    TCG_REG_O0,
46 8289b279 blueswir1
    TCG_REG_O1,
47 8289b279 blueswir1
    TCG_REG_O2,
48 8289b279 blueswir1
    TCG_REG_O3,
49 8289b279 blueswir1
    TCG_REG_O4,
50 8289b279 blueswir1
    TCG_REG_O5,
51 8289b279 blueswir1
    TCG_REG_O6,
52 8289b279 blueswir1
    TCG_REG_O7,
53 8289b279 blueswir1
    TCG_REG_L0,
54 8289b279 blueswir1
    TCG_REG_L1,
55 8289b279 blueswir1
    TCG_REG_L2,
56 8289b279 blueswir1
    TCG_REG_L3,
57 8289b279 blueswir1
    TCG_REG_L4,
58 8289b279 blueswir1
    TCG_REG_L5,
59 8289b279 blueswir1
    TCG_REG_L6,
60 8289b279 blueswir1
    TCG_REG_L7,
61 8289b279 blueswir1
    TCG_REG_I0,
62 8289b279 blueswir1
    TCG_REG_I1,
63 8289b279 blueswir1
    TCG_REG_I2,
64 8289b279 blueswir1
    TCG_REG_I3,
65 8289b279 blueswir1
    TCG_REG_I4,
66 8289b279 blueswir1
    TCG_REG_I5,
67 8289b279 blueswir1
    TCG_REG_I6,
68 8289b279 blueswir1
    TCG_REG_I7,
69 8289b279 blueswir1
};
70 8289b279 blueswir1
71 8289b279 blueswir1
#define TCG_CT_CONST_S11 0x100
72 8289b279 blueswir1
#define TCG_CT_CONST_S13 0x200
73 8289b279 blueswir1
74 8289b279 blueswir1
/* used for function call generation */
75 8289b279 blueswir1
#define TCG_REG_CALL_STACK TCG_REG_O6
76 8289b279 blueswir1
#define TCG_TARGET_STACK_ALIGN 16
77 8289b279 blueswir1
78 8289b279 blueswir1
/* optional instructions */
79 8289b279 blueswir1
//#define TCG_TARGET_HAS_bswap_i32
80 8289b279 blueswir1
//#define TCG_TARGET_HAS_bswap_i64
81 8289b279 blueswir1
82 8289b279 blueswir1
/* Note: must be synced with dyngen-exec.h */
83 8289b279 blueswir1
#ifdef HOST_SOLARIS
84 8289b279 blueswir1
#define TCG_AREG0 TCG_REG_G2
85 8289b279 blueswir1
#define TCG_AREG1 TCG_REG_G3
86 8289b279 blueswir1
#define TCG_AREG2 TCG_REG_G4
87 8289b279 blueswir1
#define TCG_AREG3 TCG_REG_G5
88 8289b279 blueswir1
#define TCG_AREG4 TCG_REG_G6
89 8289b279 blueswir1
#elif defined(__sparc_v9__)
90 8289b279 blueswir1
#define TCG_AREG0 TCG_REG_G1
91 8289b279 blueswir1
#define TCG_AREG1 TCG_REG_G4
92 8289b279 blueswir1
#define TCG_AREG2 TCG_REG_G5
93 8289b279 blueswir1
#define TCG_AREG3 TCG_REG_G7
94 8289b279 blueswir1
#else
95 8289b279 blueswir1
#define TCG_AREG0 TCG_REG_G6
96 8289b279 blueswir1
#define TCG_AREG1 TCG_REG_G1
97 8289b279 blueswir1
#define TCG_AREG2 TCG_REG_G2
98 8289b279 blueswir1
#define TCG_AREG3 TCG_REG_G3
99 8289b279 blueswir1
#endif
100 8289b279 blueswir1
101 8289b279 blueswir1
static inline void flush_icache_range(unsigned long start, unsigned long stop)
102 8289b279 blueswir1
{
103 8289b279 blueswir1
    unsigned long p;
104 8289b279 blueswir1
105 8289b279 blueswir1
    p = start & ~(8UL - 1UL);
106 8289b279 blueswir1
    stop = (stop + (8UL - 1UL)) & ~(8UL - 1UL);
107 8289b279 blueswir1
108 8289b279 blueswir1
    for (; p < stop; p += 8)
109 8289b279 blueswir1
        __asm__ __volatile__("flush\t%0" : : "r" (p));
110 8289b279 blueswir1
}