ppc fixes (Jocelyn Mayer)
[qemu.git] / target-ppc / exec.h
blobf4d20a8ad1ebc1618ca1a40d95f12905bb708f90
1 /*
2 * PPC emulation definitions for qemu.
3 *
4 * Copyright (c) 2003 Jocelyn Mayer
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.
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.
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
20 #if !defined (__PPC_H__)
21 #define __PPC_H__
23 #include "dyngen-exec.h"
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);
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 #define FTS0 ((float)env->ft0)
36 #define FTS1 ((float)env->ft1)
37 #define FTS2 ((float)env->ft2)
39 #if defined (DEBUG_OP)
40 #define RETURN() __asm__ __volatile__("nop");
41 #else
42 #define RETURN() __asm__ __volatile__("");
43 #endif
45 #include "cpu.h"
46 #include "exec-all.h"
48 static inline uint32_t rotl (uint32_t i, int n)
50 return ((i << n) | (i >> (32 - n)));
53 /* XXX: move that to a generic header */
54 #if !defined(CONFIG_USER_ONLY)
56 #define ldul_user ldl_user
57 #define ldul_kernel ldl_kernel
59 #define ACCESS_TYPE 0
60 #define MEMSUFFIX _kernel
61 #define DATA_SIZE 1
62 #include "softmmu_header.h"
64 #define DATA_SIZE 2
65 #include "softmmu_header.h"
67 #define DATA_SIZE 4
68 #include "softmmu_header.h"
70 #define DATA_SIZE 8
71 #include "softmmu_header.h"
72 #undef ACCESS_TYPE
73 #undef MEMSUFFIX
75 #define ACCESS_TYPE 1
76 #define MEMSUFFIX _user
77 #define DATA_SIZE 1
78 #include "softmmu_header.h"
80 #define DATA_SIZE 2
81 #include "softmmu_header.h"
83 #define DATA_SIZE 4
84 #include "softmmu_header.h"
86 #define DATA_SIZE 8
87 #include "softmmu_header.h"
88 #undef ACCESS_TYPE
89 #undef MEMSUFFIX
91 /* these access are slower, they must be as rare as possible */
92 #define ACCESS_TYPE 2
93 #define MEMSUFFIX _data
94 #define DATA_SIZE 1
95 #include "softmmu_header.h"
97 #define DATA_SIZE 2
98 #include "softmmu_header.h"
100 #define DATA_SIZE 4
101 #include "softmmu_header.h"
103 #define DATA_SIZE 8
104 #include "softmmu_header.h"
105 #undef ACCESS_TYPE
106 #undef MEMSUFFIX
108 #define ldub(p) ldub_data(p)
109 #define ldsb(p) ldsb_data(p)
110 #define lduw(p) lduw_data(p)
111 #define ldsw(p) ldsw_data(p)
112 #define ldl(p) ldl_data(p)
113 #define ldq(p) ldq_data(p)
115 #define stb(p, v) stb_data(p, v)
116 #define stw(p, v) stw_data(p, v)
117 #define stl(p, v) stl_data(p, v)
118 #define stq(p, v) stq_data(p, v)
120 #endif /* !defined(CONFIG_USER_ONLY) */
122 int check_exception_state (CPUState *env);
124 void do_queue_exception_err (uint32_t exception, int error_code);
125 void do_queue_exception (uint32_t exception);
126 void do_process_exceptions (void);
127 void do_check_exception_state (void);
129 void do_load_cr (void);
130 void do_store_cr (uint32_t mask);
131 void do_load_xer (void);
132 void do_store_xer (void);
133 void do_load_msr (void);
134 void do_store_msr (void);
135 void do_load_fpscr (void);
136 void do_store_fpscr (uint32_t mask);
138 void do_sraw(void);
140 void do_fctiw (void);
141 void do_fctiwz (void);
142 void do_fnmadds (void);
143 void do_fnmsubs (void);
144 void do_fsqrt (void);
145 void do_fsqrts (void);
146 void do_fres (void);
147 void do_fsqrte (void);
148 void do_fsel (void);
149 void do_fcmpu (void);
150 void do_fcmpo (void);
151 void do_fabs (void);
152 void do_fnabs (void);
154 void do_icbi (void);
155 void do_tlbia (void);
156 void do_tlbie (void);
158 void dump_state (void);
159 void dump_rfi (void);
160 void dump_store_sr (int srnum);
161 void dump_store_ibat (int ul, int nr);
162 void dump_store_dbat (int ul, int nr);
163 void dump_store_tb (int ul);
164 void dump_update_tb(uint32_t param);
166 #endif /* !defined (__PPC_H__) */