Revision 45d827d2 target-ppc/op_helper.c

b/target-ppc/op_helper.c
22 22
#include "helper.h"
23 23

  
24 24
#include "helper_regs.h"
25
#include "op_helper.h"
26 25

  
27 26
//#define DEBUG_OP
28 27
//#define DEBUG_EXCEPTIONS
......
65 64
    }
66 65
}
67 66

  
68
target_ulong ppc_load_dump_spr (int sprn)
67
/*****************************************************************************/
68
/* SPR accesses */
69
void helper_load_dump_spr (uint32_t sprn)
69 70
{
70 71
    if (loglevel != 0) {
71 72
        fprintf(logfile, "Read SPR %d %03x => " ADDRX "\n",
72 73
                sprn, sprn, env->spr[sprn]);
73 74
    }
74

  
75
    return env->spr[sprn];
76 75
}
77 76

  
78
void ppc_store_dump_spr (int sprn, target_ulong val)
77
void helper_store_dump_spr (uint32_t sprn)
79 78
{
80 79
    if (loglevel != 0) {
81
        fprintf(logfile, "Write SPR %d %03x => " ADDRX " <= " ADDRX "\n",
82
                sprn, sprn, env->spr[sprn], val);
80
        fprintf(logfile, "Write SPR %d %03x <= " ADDRX "\n",
81
                sprn, sprn, env->spr[sprn]);
82
    }
83
}
84

  
85
target_ulong helper_load_tbl (void)
86
{
87
    return cpu_ppc_load_tbl(env);
88
}
89

  
90
target_ulong helper_load_tbu (void)
91
{
92
    return cpu_ppc_load_tbu(env);
93
}
94

  
95
target_ulong helper_load_atbl (void)
96
{
97
    return cpu_ppc_load_atbl(env);
98
}
99

  
100
target_ulong helper_load_atbu (void)
101
{
102
    return cpu_ppc_load_atbu(env);
103
}
104

  
105
target_ulong helper_load_601_rtcl (void)
106
{
107
    return cpu_ppc601_load_rtcl(env);
108
}
109

  
110
target_ulong helper_load_601_rtcu (void)
111
{
112
    return cpu_ppc601_load_rtcu(env);
113
}
114

  
115
#if !defined(CONFIG_USER_ONLY)
116
#if defined (TARGET_PPC64)
117
void helper_store_asr (target_ulong val)
118
{
119
    ppc_store_asr(env, val);
120
}
121
#endif
122

  
123
void helper_store_sdr1 (target_ulong val)
124
{
125
    ppc_store_sdr1(env, val);
126
}
127

  
128
void helper_store_tbl (target_ulong val)
129
{
130
    cpu_ppc_store_tbl(env, val);
131
}
132

  
133
void helper_store_tbu (target_ulong val)
134
{
135
    cpu_ppc_store_tbu(env, val);
136
}
137

  
138
void helper_store_atbl (target_ulong val)
139
{
140
    cpu_ppc_store_atbl(env, val);
141
}
142

  
143
void helper_store_atbu (target_ulong val)
144
{
145
    cpu_ppc_store_atbu(env, val);
146
}
147

  
148
void helper_store_601_rtcl (target_ulong val)
149
{
150
    cpu_ppc601_store_rtcl(env, val);
151
}
152

  
153
void helper_store_601_rtcu (target_ulong val)
154
{
155
    cpu_ppc601_store_rtcu(env, val);
156
}
157

  
158
target_ulong helper_load_decr (void)
159
{
160
    return cpu_ppc_load_decr(env);
161
}
162

  
163
void helper_store_decr (target_ulong val)
164
{
165
    cpu_ppc_store_decr(env, val);
166
}
167

  
168
void helper_store_hid0_601 (target_ulong val)
169
{
170
    target_ulong hid0;
171

  
172
    hid0 = env->spr[SPR_HID0];
173
    if ((val ^ hid0) & 0x00000008) {
174
        /* Change current endianness */
175
        env->hflags &= ~(1 << MSR_LE);
176
        env->hflags_nmsr &= ~(1 << MSR_LE);
177
        env->hflags_nmsr |= (1 << MSR_LE) & (((val >> 3) & 1) << MSR_LE);
178
        env->hflags |= env->hflags_nmsr;
179
        if (loglevel != 0) {
180
            fprintf(logfile, "%s: set endianness to %c => " ADDRX "\n",
181
                    __func__, val & 0x8 ? 'l' : 'b', env->hflags);
182
        }
83 183
    }
84
    env->spr[sprn] = val;
184
    env->spr[SPR_HID0] = (uint32_t)val;
185
}
186

  
187
void helper_store_403_pbr (uint32_t num, target_ulong value)
188
{
189
    if (likely(env->pb[num] != value)) {
190
        env->pb[num] = value;
191
        /* Should be optimized */
192
        tlb_flush(env, 1);
193
    }
194
}
195

  
196
target_ulong helper_load_40x_pit (void)
197
{
198
    return load_40x_pit(env);
199
}
200

  
201
void helper_store_40x_pit (target_ulong val)
202
{
203
    store_40x_pit(env, val);
204
}
205

  
206
void helper_store_40x_dbcr0 (target_ulong val)
207
{
208
    store_40x_dbcr0(env, val);
209
}
210

  
211
void helper_store_40x_sler (target_ulong val)
212
{
213
    store_40x_sler(env, val);
214
}
215

  
216
void helper_store_booke_tcr (target_ulong val)
217
{
218
    store_booke_tcr(env, val);
219
}
220

  
221
void helper_store_booke_tsr (target_ulong val)
222
{
223
    store_booke_tsr(env, val);
224
}
225

  
226
void helper_store_ibatu (uint32_t nr, target_ulong val)
227
{
228
    ppc_store_ibatu(env, nr, val);
229
}
230

  
231
void helper_store_ibatl (uint32_t nr, target_ulong val)
232
{
233
    ppc_store_ibatl(env, nr, val);
234
}
235

  
236
void helper_store_dbatu (uint32_t nr, target_ulong val)
237
{
238
    ppc_store_dbatu(env, nr, val);
85 239
}
86 240

  
241
void helper_store_dbatl (uint32_t nr, target_ulong val)
242
{
243
    ppc_store_dbatl(env, nr, val);
244
}
245

  
246
void helper_store_601_batl (uint32_t nr, target_ulong val)
247
{
248
    ppc_store_ibatl_601(env, nr, val);
249
}
250

  
251
void helper_store_601_batu (uint32_t nr, target_ulong val)
252
{
253
    ppc_store_ibatu_601(env, nr, val);
254
}
255
#endif
256

  
87 257
/*****************************************************************************/
88 258
/* Memory load and stores */
89 259

  
......
1678 1848
{
1679 1849
    do_rfi(env->lr, env->ctr, 0x0000FFFF, 0);
1680 1850
}
1681

  
1682
void do_store_hid0_601 (void)
1683
{
1684
    uint32_t hid0;
1685

  
1686
    hid0 = env->spr[SPR_HID0];
1687
    if ((T0 ^ hid0) & 0x00000008) {
1688
        /* Change current endianness */
1689
        env->hflags &= ~(1 << MSR_LE);
1690
        env->hflags_nmsr &= ~(1 << MSR_LE);
1691
        env->hflags_nmsr |= (1 << MSR_LE) & (((T0 >> 3) & 1) << MSR_LE);
1692
        env->hflags |= env->hflags_nmsr;
1693
        if (loglevel != 0) {
1694
            fprintf(logfile, "%s: set endianness to %c => " ADDRX "\n",
1695
                    __func__, T0 & 0x8 ? 'l' : 'b', env->hflags);
1696
        }
1697
    }
1698
    env->spr[SPR_HID0] = T0;
1699
}
1700 1851
#endif
1701 1852

  
1702 1853
/*****************************************************************************/
......
1709 1860
    if (likely(arg < 602)) {
1710 1861
#if defined(USE_MFROM_ROM_TABLE)
1711 1862
#include "mfrom_table.c"
1712
        return mfrom_ROM_table[T0];
1863
        return mfrom_ROM_table[arg];
1713 1864
#else
1714 1865
        double d;
1715 1866
        /* Extremly decomposed:
......
1747 1898
                            POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL);
1748 1899
    } else if (unlikely(ppc_dcr_read(env->dcr_env, dcrn, &val) != 0)) {
1749 1900
        if (loglevel != 0) {
1750
            fprintf(logfile, "DCR read error %d %03x\n", (int)T0, (int)T0);
1901
            fprintf(logfile, "DCR read error %d %03x\n", (int)dcrn, (int)dcrn);
1751 1902
        }
1752 1903
        raise_exception_err(env, POWERPC_EXCP_PROGRAM,
1753 1904
                            POWERPC_EXCP_INVAL | POWERPC_EXCP_PRIV_REG);
......
1765 1916
                            POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL);
1766 1917
    } else if (unlikely(ppc_dcr_write(env->dcr_env, dcrn, val) != 0)) {
1767 1918
        if (loglevel != 0) {
1768
            fprintf(logfile, "DCR write error %d %03x\n", (int)T0, (int)T0);
1919
            fprintf(logfile, "DCR write error %d %03x\n", (int)dcrn, (int)dcrn);
1769 1920
        }
1770 1921
        raise_exception_err(env, POWERPC_EXCP_PROGRAM,
1771 1922
                            POWERPC_EXCP_INVAL | POWERPC_EXCP_PRIV_REG);
......
1796 1947
    do_rfi(env->spr[SPR_BOOKE_MCSRR0], SPR_BOOKE_MCSRR1,
1797 1948
           ~((target_ulong)0x3FFF0000), 0);
1798 1949
}
1799

  
1800
void do_load_403_pb (int num)
1801
{
1802
    T0 = env->pb[num];
1803
}
1804

  
1805
void do_store_403_pb (int num)
1806
{
1807
    if (likely(env->pb[num] != T0)) {
1808
        env->pb[num] = T0;
1809
        /* Should be optimized */
1810
        tlb_flush(env, 1);
1811
    }
1812
}
1813 1950
#endif
1814 1951

  
1815 1952
/* 440 specific */
......
2539 2676

  
2540 2677
void helper_store_sr (target_ulong sr_num, target_ulong val)
2541 2678
{
2542
    do_store_sr(env, sr_num, val);
2679
    ppc_store_sr(env, sr_num, val);
2543 2680
}
2544 2681

  
2545 2682
/* SLB management */

Also available in: Unified diff