Statistics
| Branch: | Revision:

root / tcg / hppa / tcg-target.h @ fd76e73a

History | View | Annotate | Download (3.1 kB)

1 f54b3f92 aurel32
/*
2 f54b3f92 aurel32
 * Tiny Code Generator for QEMU
3 f54b3f92 aurel32
 *
4 f54b3f92 aurel32
 * Copyright (c) 2008 Fabrice Bellard
5 f54b3f92 aurel32
 *
6 f54b3f92 aurel32
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 f54b3f92 aurel32
 * of this software and associated documentation files (the "Software"), to deal
8 f54b3f92 aurel32
 * in the Software without restriction, including without limitation the rights
9 f54b3f92 aurel32
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 f54b3f92 aurel32
 * copies of the Software, and to permit persons to whom the Software is
11 f54b3f92 aurel32
 * furnished to do so, subject to the following conditions:
12 f54b3f92 aurel32
 *
13 f54b3f92 aurel32
 * The above copyright notice and this permission notice shall be included in
14 f54b3f92 aurel32
 * all copies or substantial portions of the Software.
15 f54b3f92 aurel32
 *
16 f54b3f92 aurel32
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 f54b3f92 aurel32
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 f54b3f92 aurel32
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 f54b3f92 aurel32
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 f54b3f92 aurel32
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 f54b3f92 aurel32
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 f54b3f92 aurel32
 * THE SOFTWARE.
23 f54b3f92 aurel32
 */
24 f54b3f92 aurel32
25 f54b3f92 aurel32
#define TCG_TARGET_HPPA 1
26 f54b3f92 aurel32
27 f54b3f92 aurel32
#if defined(_PA_RISC1_1)
28 f54b3f92 aurel32
#define TCG_TARGET_REG_BITS 32
29 f54b3f92 aurel32
#else
30 f54b3f92 aurel32
#error unsupported
31 f54b3f92 aurel32
#endif
32 f54b3f92 aurel32
33 f54b3f92 aurel32
#define TCG_TARGET_WORDS_BIGENDIAN
34 f54b3f92 aurel32
35 f54b3f92 aurel32
#define TCG_TARGET_NB_REGS 32
36 f54b3f92 aurel32
37 f54b3f92 aurel32
enum {
38 f54b3f92 aurel32
    TCG_REG_R0 = 0,
39 f54b3f92 aurel32
    TCG_REG_R1,
40 f54b3f92 aurel32
    TCG_REG_RP,
41 f54b3f92 aurel32
    TCG_REG_R3,
42 f54b3f92 aurel32
    TCG_REG_R4,
43 f54b3f92 aurel32
    TCG_REG_R5,
44 f54b3f92 aurel32
    TCG_REG_R6,
45 f54b3f92 aurel32
    TCG_REG_R7,
46 f54b3f92 aurel32
    TCG_REG_R8,
47 f54b3f92 aurel32
    TCG_REG_R9,
48 f54b3f92 aurel32
    TCG_REG_R10,
49 f54b3f92 aurel32
    TCG_REG_R11,
50 f54b3f92 aurel32
    TCG_REG_R12,
51 f54b3f92 aurel32
    TCG_REG_R13,
52 f54b3f92 aurel32
    TCG_REG_R14,
53 f54b3f92 aurel32
    TCG_REG_R15,
54 f54b3f92 aurel32
    TCG_REG_R16,
55 f54b3f92 aurel32
    TCG_REG_R17,
56 f54b3f92 aurel32
    TCG_REG_R18,
57 f54b3f92 aurel32
    TCG_REG_R19,
58 f54b3f92 aurel32
    TCG_REG_R20,
59 f54b3f92 aurel32
    TCG_REG_R21,
60 f54b3f92 aurel32
    TCG_REG_R22,
61 f54b3f92 aurel32
    TCG_REG_R23,
62 f54b3f92 aurel32
    TCG_REG_R24,
63 f54b3f92 aurel32
    TCG_REG_R25,
64 f54b3f92 aurel32
    TCG_REG_R26,
65 f54b3f92 aurel32
    TCG_REG_DP,
66 f54b3f92 aurel32
    TCG_REG_RET0,
67 f54b3f92 aurel32
    TCG_REG_RET1,
68 f54b3f92 aurel32
    TCG_REG_SP,
69 f54b3f92 aurel32
    TCG_REG_R31,
70 f54b3f92 aurel32
};
71 f54b3f92 aurel32
72 fd76e73a Richard Henderson
#define TCG_CT_CONST_0    0x0100
73 fd76e73a Richard Henderson
#define TCG_CT_CONST_S5   0x0200
74 fd76e73a Richard Henderson
#define TCG_CT_CONST_S11  0x0400
75 fd76e73a Richard Henderson
76 f54b3f92 aurel32
/* used for function call generation */
77 f54b3f92 aurel32
#define TCG_REG_CALL_STACK TCG_REG_SP
78 fd76e73a Richard Henderson
#define TCG_TARGET_STACK_ALIGN 64
79 fd76e73a Richard Henderson
#define TCG_TARGET_CALL_STACK_OFFSET -48
80 fd76e73a Richard Henderson
#define TCG_TARGET_STATIC_CALL_ARGS_SIZE 8*4
81 fd76e73a Richard Henderson
#define TCG_TARGET_CALL_ALIGN_ARGS 1
82 f54b3f92 aurel32
#define TCG_TARGET_STACK_GROWSUP
83 f54b3f92 aurel32
84 f54b3f92 aurel32
/* optional instructions */
85 fd76e73a Richard Henderson
// #define TCG_TARGET_HAS_div_i32
86 fd76e73a Richard Henderson
#define TCG_TARGET_HAS_rot_i32
87 fd76e73a Richard Henderson
#define TCG_TARGET_HAS_ext8s_i32
88 fd76e73a Richard Henderson
#define TCG_TARGET_HAS_ext16s_i32
89 fd76e73a Richard Henderson
#define TCG_TARGET_HAS_ext8u_i32
90 fd76e73a Richard Henderson
#define TCG_TARGET_HAS_ext16u_i32
91 fd76e73a Richard Henderson
#define TCG_TARGET_HAS_bswap16_i32
92 fd76e73a Richard Henderson
#define TCG_TARGET_HAS_bswap32_i32
93 fd76e73a Richard Henderson
#define TCG_TARGET_HAS_not_i32
94 fd76e73a Richard Henderson
#define TCG_TARGET_HAS_neg_i32
95 fd76e73a Richard Henderson
#define TCG_TARGET_HAS_andc_i32
96 fd76e73a Richard Henderson
// #define TCG_TARGET_HAS_orc_i32
97 fd76e73a Richard Henderson
98 fd76e73a Richard Henderson
#define TCG_TARGET_HAS_GUEST_BASE
99 f54b3f92 aurel32
100 f54b3f92 aurel32
/* Note: must be synced with dyngen-exec.h */
101 f54b3f92 aurel32
#define TCG_AREG0 TCG_REG_R17
102 f54b3f92 aurel32
103 f54b3f92 aurel32
static inline void flush_icache_range(unsigned long start, unsigned long stop)
104 f54b3f92 aurel32
{
105 f54b3f92 aurel32
    start &= ~31;
106 fd76e73a Richard Henderson
    while (start <= stop) {
107 fd76e73a Richard Henderson
        asm volatile ("fdc 0(%0)\n\t"
108 fd76e73a Richard Henderson
                      "sync\n\t"
109 fd76e73a Richard Henderson
                      "fic 0(%%sr4, %0)\n\t"
110 fd76e73a Richard Henderson
                      "sync"
111 f54b3f92 aurel32
                      : : "r"(start) : "memory");
112 f54b3f92 aurel32
        start += 32;
113 f54b3f92 aurel32
    }
114 f54b3f92 aurel32
}