Revision 9a64fbe4 target-ppc/exec.h

b/target-ppc/exec.h
41 41
#include "cpu.h"
42 42
#include "exec-all.h"
43 43

  
44
static inline uint8_t ld8 (uint32_t EA)
44
static inline uint32_t rotl (uint32_t i, int n)
45 45
{
46
    return *((uint8_t *)EA);
46
    return ((i << n) | (i >> (32 - n)));
47 47
}
48 48

  
49
static inline uint16_t ld16 (uint32_t EA)
50
{
51
    return __be16_to_cpu(*((uint16_t *)EA));
52
}
49
/* XXX: move that to a generic header */
50
#if !defined(CONFIG_USER_ONLY)
53 51

  
54
static inline uint16_t ld16r (uint32_t EA)
55
{
56
    return __le16_to_cpu(*((uint16_t *)EA));
57
}
52
#define ldul_user ldl_user
53
#define ldul_kernel ldl_kernel
58 54

  
59
static inline uint32_t ld32 (uint32_t EA)
60
{
61
    return __be32_to_cpu(*((uint32_t *)EA));
62
}
63

  
64
static inline uint32_t ld32r (uint32_t EA)
65
{
66
    return __le32_to_cpu(*((uint32_t *)EA));
67
}
55
#define ACCESS_TYPE 0
56
#define MEMSUFFIX _kernel
57
#define DATA_SIZE 1
58
#include "softmmu_header.h"
68 59

  
69
static inline uint64_t ld64 (uint32_t EA)
70
{
71
    return __be64_to_cpu(*((uint64_t *)EA));
72
}
60
#define DATA_SIZE 2
61
#include "softmmu_header.h"
73 62

  
74
static inline uint64_t ld64r (uint32_t EA)
75
{
76
    return __le64_to_cpu(*((uint64_t *)EA));
77
}
63
#define DATA_SIZE 4
64
#include "softmmu_header.h"
78 65

  
79
static inline void st8 (uint32_t EA, uint8_t data)
80
{
81
    *((uint8_t *)EA) = data;
82
}
66
#define DATA_SIZE 8
67
#include "softmmu_header.h"
68
#undef ACCESS_TYPE
69
#undef MEMSUFFIX
83 70

  
84
static inline void st16 (uint32_t EA, uint16_t data)
85
{
86
    *((uint16_t *)EA) = __cpu_to_be16(data);
87
}
71
#define ACCESS_TYPE 1
72
#define MEMSUFFIX _user
73
#define DATA_SIZE 1
74
#include "softmmu_header.h"
88 75

  
89
static inline void st16r (uint32_t EA, uint16_t data)
90
{
91
    *((uint16_t *)EA) = __cpu_to_le16(data);
92
}
76
#define DATA_SIZE 2
77
#include "softmmu_header.h"
93 78

  
94
static inline void st32 (uint32_t EA, uint32_t data)
95
{
96
    *((uint32_t *)EA) = __cpu_to_be32(data);
97
}
79
#define DATA_SIZE 4
80
#include "softmmu_header.h"
98 81

  
99
static inline void st32r (uint32_t EA, uint32_t data)
100
{
101
    *((uint32_t *)EA) = __cpu_to_le32(data);
102
}
82
#define DATA_SIZE 8
83
#include "softmmu_header.h"
84
#undef ACCESS_TYPE
85
#undef MEMSUFFIX
103 86

  
104
static inline void st64 (uint32_t EA, uint64_t data)
105
{
106
    *((uint64_t *)EA) = __cpu_to_be64(data);
107
}
87
/* these access are slower, they must be as rare as possible */
88
#define ACCESS_TYPE 2
89
#define MEMSUFFIX _data
90
#define DATA_SIZE 1
91
#include "softmmu_header.h"
108 92

  
109
static inline void st64r (uint32_t EA, uint64_t data)
110
{
111
    *((uint64_t *)EA) = __cpu_to_le64(data);
112
}
93
#define DATA_SIZE 2
94
#include "softmmu_header.h"
113 95

  
114
static inline void set_CRn(int n, uint8_t value)
115
{
116
    env->crf[n] = value;
117
}
96
#define DATA_SIZE 4
97
#include "softmmu_header.h"
118 98

  
119
static inline void set_carry (void)
120
{
121
    xer_ca = 1;
122
}
99
#define DATA_SIZE 8
100
#include "softmmu_header.h"
101
#undef ACCESS_TYPE
102
#undef MEMSUFFIX
123 103

  
124
static inline void reset_carry (void)
125
{
126
    xer_ca = 0;
127
}
104
#define ldub(p) ldub_data(p)
105
#define ldsb(p) ldsb_data(p)
106
#define lduw(p) lduw_data(p)
107
#define ldsw(p) ldsw_data(p)
108
#define ldl(p) ldl_data(p)
109
#define ldq(p) ldq_data(p)
128 110

  
129
static inline void set_overflow (void)
130
{
131
    xer_so = 1;
132
    xer_ov = 1;
133
}
111
#define stb(p, v) stb_data(p, v)
112
#define stw(p, v) stw_data(p, v)
113
#define stl(p, v) stl_data(p, v)
114
#define stq(p, v) stq_data(p, v)
134 115

  
135
static inline void reset_overflow (void)
136
{
137
    xer_ov = 0;
138
}
116
#endif /* !defined(CONFIG_USER_ONLY) */
139 117

  
140
static inline uint32_t rotl (uint32_t i, int n)
141
{
142
    return ((i << n) | (i >> (32 - n)));
143
}
118
int check_exception_state (CPUState *env);
144 119

  
145
void raise_exception (int exception_index);
146
void raise_exception_err (int exception_index, int error_code);
120
void do_queue_exception_err (uint32_t exception, int error_code);
121
void do_queue_exception (uint32_t exception);
122
void do_process_exceptions (void);
123
void do_check_exception_state (void);
147 124

  
148
uint32_t do_load_cr (void);
149
void do_store_cr (uint32_t crn, uint32_t value);
150
uint32_t do_load_xer (void);
151
void do_store_xer (uint32_t value);
152
uint32_t do_load_msr (void);
153
void do_store_msr (uint32_t msr_value);
125
void do_load_cr (void);
126
void do_store_cr (uint32_t mask);
127
void do_load_xer (void);
128
void do_store_xer (void);
129
void do_load_msr (void);
130
void do_store_msr (void);
154 131
void do_load_fpscr (void);
155 132
void do_store_fpscr (uint32_t mask);
156 133

  
157
int32_t do_sraw(int32_t Ta, uint32_t Tb);
158
void do_lmw (int reg, uint32_t src);
159
void do_stmw (int reg, uint32_t dest);
160
void do_lsw (uint32_t reg, int count, uint32_t src);
161
void do_stsw (uint32_t reg, int count, uint32_t dest);
134
void do_sraw(void);
135

  
136
void do_fctiw (void);
137
void do_fctiwz (void);
138
void do_fsqrt (void);
139
void do_fsqrts (void);
140
void do_fres (void);
141
void do_fsqrte (void);
142
void do_fsel (void);
143
void do_fcmpu (void);
144
void do_fcmpo (void);
145
void do_fabs (void);
146
void do_fnabs (void);
162 147

  
163
void do_dcbz (void);
164 148
void do_icbi (void);
149
void do_tlbia (void);
150
void do_tlbie (void);
151

  
152
void dump_rfi (void);
153
void dump_store_sr (int srnum);
154
void dump_store_ibat (int ul, int nr);
155
void dump_store_dbat (int ul, int nr);
156
void dump_store_tb (int ul);
157
void dump_update_tb(uint32_t param);
165 158

  
166 159
#endif /* !defined (__PPC_H__) */

Also available in: Unified diff