root / tcg / mips / tcg-target.h @ 4cb26382
History | View | Annotate | Download (3 kB)
1 | afa05235 | Aurelien Jarno | /*
|
---|---|---|---|
2 | afa05235 | Aurelien Jarno | * Tiny Code Generator for QEMU
|
3 | afa05235 | Aurelien Jarno | *
|
4 | afa05235 | Aurelien Jarno | * Copyright (c) 2008-2009 Arnaud Patard <arnaud.patard@rtp-net.org>
|
5 | afa05235 | Aurelien Jarno | * Copyright (c) 2009 Aurelien Jarno <aurelien@aurel32.net>
|
6 | afa05235 | Aurelien Jarno | * Based on i386/tcg-target.c - Copyright (c) 2008 Fabrice Bellard
|
7 | afa05235 | Aurelien Jarno | *
|
8 | afa05235 | Aurelien Jarno | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 | afa05235 | Aurelien Jarno | * of this software and associated documentation files (the "Software"), to deal
|
10 | afa05235 | Aurelien Jarno | * in the Software without restriction, including without limitation the rights
|
11 | afa05235 | Aurelien Jarno | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12 | afa05235 | Aurelien Jarno | * copies of the Software, and to permit persons to whom the Software is
|
13 | afa05235 | Aurelien Jarno | * furnished to do so, subject to the following conditions:
|
14 | afa05235 | Aurelien Jarno | *
|
15 | afa05235 | Aurelien Jarno | * The above copyright notice and this permission notice shall be included in
|
16 | afa05235 | Aurelien Jarno | * all copies or substantial portions of the Software.
|
17 | afa05235 | Aurelien Jarno | *
|
18 | afa05235 | Aurelien Jarno | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 | afa05235 | Aurelien Jarno | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 | afa05235 | Aurelien Jarno | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
21 | afa05235 | Aurelien Jarno | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 | afa05235 | Aurelien Jarno | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23 | afa05235 | Aurelien Jarno | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24 | afa05235 | Aurelien Jarno | * THE SOFTWARE.
|
25 | afa05235 | Aurelien Jarno | */
|
26 | afa05235 | Aurelien Jarno | #define TCG_TARGET_MIPS 1 |
27 | afa05235 | Aurelien Jarno | |
28 | afa05235 | Aurelien Jarno | #define TCG_TARGET_REG_BITS 32 |
29 | afa05235 | Aurelien Jarno | #ifdef __MIPSEB__
|
30 | afa05235 | Aurelien Jarno | # define TCG_TARGET_WORDS_BIGENDIAN
|
31 | afa05235 | Aurelien Jarno | #endif
|
32 | afa05235 | Aurelien Jarno | |
33 | afa05235 | Aurelien Jarno | #define TCG_TARGET_NB_REGS 32 |
34 | afa05235 | Aurelien Jarno | |
35 | afa05235 | Aurelien Jarno | enum {
|
36 | afa05235 | Aurelien Jarno | TCG_REG_ZERO = 0,
|
37 | afa05235 | Aurelien Jarno | TCG_REG_AT, |
38 | afa05235 | Aurelien Jarno | TCG_REG_V0, |
39 | afa05235 | Aurelien Jarno | TCG_REG_V1, |
40 | afa05235 | Aurelien Jarno | TCG_REG_A0, |
41 | afa05235 | Aurelien Jarno | TCG_REG_A1, |
42 | afa05235 | Aurelien Jarno | TCG_REG_A2, |
43 | afa05235 | Aurelien Jarno | TCG_REG_A3, |
44 | afa05235 | Aurelien Jarno | TCG_REG_T0, |
45 | afa05235 | Aurelien Jarno | TCG_REG_T1, |
46 | afa05235 | Aurelien Jarno | TCG_REG_T2, |
47 | afa05235 | Aurelien Jarno | TCG_REG_T3, |
48 | afa05235 | Aurelien Jarno | TCG_REG_T4, |
49 | afa05235 | Aurelien Jarno | TCG_REG_T5, |
50 | afa05235 | Aurelien Jarno | TCG_REG_T6, |
51 | afa05235 | Aurelien Jarno | TCG_REG_T7, |
52 | afa05235 | Aurelien Jarno | TCG_REG_S0, |
53 | afa05235 | Aurelien Jarno | TCG_REG_S1, |
54 | afa05235 | Aurelien Jarno | TCG_REG_S2, |
55 | afa05235 | Aurelien Jarno | TCG_REG_S3, |
56 | afa05235 | Aurelien Jarno | TCG_REG_S4, |
57 | afa05235 | Aurelien Jarno | TCG_REG_S5, |
58 | afa05235 | Aurelien Jarno | TCG_REG_S6, |
59 | afa05235 | Aurelien Jarno | TCG_REG_S7, |
60 | afa05235 | Aurelien Jarno | TCG_REG_T8, |
61 | afa05235 | Aurelien Jarno | TCG_REG_T9, |
62 | afa05235 | Aurelien Jarno | TCG_REG_K0, |
63 | afa05235 | Aurelien Jarno | TCG_REG_K1, |
64 | afa05235 | Aurelien Jarno | TCG_REG_GP, |
65 | afa05235 | Aurelien Jarno | TCG_REG_SP, |
66 | afa05235 | Aurelien Jarno | TCG_REG_FP, |
67 | afa05235 | Aurelien Jarno | TCG_REG_RA, |
68 | afa05235 | Aurelien Jarno | }; |
69 | afa05235 | Aurelien Jarno | |
70 | afa05235 | Aurelien Jarno | #define TCG_CT_CONST_ZERO 0x100 |
71 | afa05235 | Aurelien Jarno | #define TCG_CT_CONST_U16 0x200 |
72 | afa05235 | Aurelien Jarno | #define TCG_CT_CONST_S16 0x400 |
73 | afa05235 | Aurelien Jarno | |
74 | afa05235 | Aurelien Jarno | /* used for function call generation */
|
75 | afa05235 | Aurelien Jarno | #define TCG_REG_CALL_STACK TCG_REG_SP
|
76 | afa05235 | Aurelien Jarno | #define TCG_TARGET_STACK_ALIGN 8 |
77 | afa05235 | Aurelien Jarno | #define TCG_TARGET_CALL_STACK_OFFSET 16 |
78 | afa05235 | Aurelien Jarno | #define TCG_TARGET_CALL_ALIGN_ARGS 1 |
79 | afa05235 | Aurelien Jarno | |
80 | afa05235 | Aurelien Jarno | /* optional instructions */
|
81 | afa05235 | Aurelien Jarno | #define TCG_TARGET_HAS_div_i32
|
82 | afa05235 | Aurelien Jarno | #define TCG_TARGET_HAS_not_i32
|
83 | afa05235 | Aurelien Jarno | #undef TCG_TARGET_HAS_ext8s_i32
|
84 | afa05235 | Aurelien Jarno | #undef TCG_TARGET_HAS_ext16s_i32
|
85 | afa05235 | Aurelien Jarno | #undef TCG_TARGET_HAS_bswap32_i32
|
86 | afa05235 | Aurelien Jarno | #undef TCG_TARGET_HAS_bswap16_i32
|
87 | afa05235 | Aurelien Jarno | #undef TCG_TARGET_HAS_rot_i32
|
88 | afa05235 | Aurelien Jarno | |
89 | afa05235 | Aurelien Jarno | /* optional instructions automatically implemented */
|
90 | afa05235 | Aurelien Jarno | #undef TCG_TARGET_HAS_neg_i32 /* sub rd, zero, rt */ |
91 | afa05235 | Aurelien Jarno | #undef TCG_TARGET_HAS_ext8u_i32 /* andi rt, rs, 0xff */ |
92 | afa05235 | Aurelien Jarno | #undef TCG_TARGET_HAS_ext16u_i32 /* andi rt, rs, 0xffff */ |
93 | afa05235 | Aurelien Jarno | |
94 | afa05235 | Aurelien Jarno | /* Note: must be synced with dyngen-exec.h */
|
95 | afa05235 | Aurelien Jarno | #define TCG_AREG0 TCG_REG_FP
|
96 | afa05235 | Aurelien Jarno | #define TCG_AREG1 TCG_REG_S0
|
97 | afa05235 | Aurelien Jarno | #define TCG_AREG2 TCG_REG_S1
|
98 | afa05235 | Aurelien Jarno | |
99 | afa05235 | Aurelien Jarno | #include <sys/cachectl.h> |
100 | afa05235 | Aurelien Jarno | |
101 | afa05235 | Aurelien Jarno | static inline void flush_icache_range(unsigned long start, unsigned long stop) |
102 | afa05235 | Aurelien Jarno | { |
103 | afa05235 | Aurelien Jarno | cacheflush ((void *)start, stop-start, ICACHE);
|
104 | afa05235 | Aurelien Jarno | } |