MIPS_USES_R4K_TLB typo
[qemu] / target-ppc / exec.h
1 /*
2  *  PPC emulation definitions for qemu.
3  * 
4  *  Copyright (c) 2003 Jocelyn Mayer
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 #if !defined (__PPC_H__)
21 #define __PPC_H__
22
23 #include "dyngen-exec.h"
24
25 register struct CPUPPCState *env asm(AREG0);
26 register uint32_t T0 asm(AREG1);
27 register uint32_t T1 asm(AREG2);
28 register uint32_t T2 asm(AREG3);
29
30 #define PARAM(n) ((uint32_t)PARAM##n)
31 #define SPARAM(n) ((int32_t)PARAM##n)
32 #define FT0 (env->ft0)
33 #define FT1 (env->ft1)
34 #define FT2 (env->ft2)
35
36 #if defined (DEBUG_OP)
37 #define RETURN() __asm__ __volatile__("nop");
38 #else
39 #define RETURN() __asm__ __volatile__("");
40 #endif
41
42 #include "cpu.h"
43 #include "exec-all.h"
44
45 static inline uint32_t rotl (uint32_t i, int n)
46 {
47     return ((i << n) | (i >> (32 - n)));
48 }
49
50 /* XXX: move that to a generic header */
51 #if !defined(CONFIG_USER_ONLY)
52
53 #define ldul_user ldl_user
54 #define ldul_kernel ldl_kernel
55
56 #define ACCESS_TYPE 0
57 #define MEMSUFFIX _kernel
58 #define DATA_SIZE 1
59 #include "softmmu_header.h"
60
61 #define DATA_SIZE 2
62 #include "softmmu_header.h"
63
64 #define DATA_SIZE 4
65 #include "softmmu_header.h"
66
67 #define DATA_SIZE 8
68 #include "softmmu_header.h"
69 #undef ACCESS_TYPE
70 #undef MEMSUFFIX
71
72 #define ACCESS_TYPE 1
73 #define MEMSUFFIX _user
74 #define DATA_SIZE 1
75 #include "softmmu_header.h"
76
77 #define DATA_SIZE 2
78 #include "softmmu_header.h"
79
80 #define DATA_SIZE 4
81 #include "softmmu_header.h"
82
83 #define DATA_SIZE 8
84 #include "softmmu_header.h"
85 #undef ACCESS_TYPE
86 #undef MEMSUFFIX
87
88 /* these access are slower, they must be as rare as possible */
89 #define ACCESS_TYPE 2
90 #define MEMSUFFIX _data
91 #define DATA_SIZE 1
92 #include "softmmu_header.h"
93
94 #define DATA_SIZE 2
95 #include "softmmu_header.h"
96
97 #define DATA_SIZE 4
98 #include "softmmu_header.h"
99
100 #define DATA_SIZE 8
101 #include "softmmu_header.h"
102 #undef ACCESS_TYPE
103 #undef MEMSUFFIX
104
105 #define ldub(p) ldub_data(p)
106 #define ldsb(p) ldsb_data(p)
107 #define lduw(p) lduw_data(p)
108 #define ldsw(p) ldsw_data(p)
109 #define ldl(p) ldl_data(p)
110 #define ldq(p) ldq_data(p)
111
112 #define stb(p, v) stb_data(p, v)
113 #define stw(p, v) stw_data(p, v)
114 #define stl(p, v) stl_data(p, v)
115 #define stq(p, v) stq_data(p, v)
116
117 #endif /* !defined(CONFIG_USER_ONLY) */
118
119 void do_raise_exception_err (uint32_t exception, int error_code);
120 void do_raise_exception (uint32_t exception);
121
122 void do_load_cr (void);
123 void do_store_cr (uint32_t mask);
124 void do_load_xer (void);
125 void do_store_xer (void);
126 void do_load_msr (void);
127 void do_store_msr (void);
128 void do_load_fpscr (void);
129 void do_store_fpscr (uint32_t mask);
130
131 void do_sraw(void);
132
133 void do_fctiw (void);
134 void do_fctiwz (void);
135 void do_fnmadd (void);
136 void do_fnmsub (void);
137 void do_fsqrt (void);
138 void do_fres (void);
139 void do_frsqrte (void);
140 void do_fsel (void);
141 void do_fcmpu (void);
142 void do_fcmpo (void);
143
144 void do_check_reservation (void);
145 void do_icbi (void);
146 void do_store_sr (uint32_t srnum);
147 void do_store_ibat (int ul, int nr);
148 void do_store_dbat (int ul, int nr);
149 void do_tlbia (void);
150 void do_tlbie (void);
151
152 void dump_state (void);
153 void dump_rfi (void);
154 void dump_store_sr (int srnum);
155 void dump_store_ibat (int ul, int nr);
156 void dump_store_dbat (int ul, int nr);
157 void dump_store_tb (int ul);
158 void dump_update_tb(uint32_t param);
159
160 static inline void env_to_regs(void)
161 {
162 }
163
164 static inline void regs_to_env(void)
165 {
166 }
167
168 int cpu_ppc_handle_mmu_fault (CPUState *env, uint32_t address, int rw,
169                               int is_user, int is_softmmu);
170
171 #endif /* !defined (__PPC_H__) */