23
23
#define SIGNBIT (uint32_t)0x80000000
24
24
#define SIGNBIT64 ((uint64_t)1 << 63)
26
#if !defined(CONFIG_USER_ONLY)
27
26
static void raise_exception(int tt)
29
28
env->exception_index = tt;
30
29
cpu_loop_exit(env);
34
32
uint32_t HELPER(neon_tbl)(uint32_t ireg, uint32_t def,
35
33
uint32_t rn, uint32_t maxindex)
75
73
NULL, it means that the function was called in C code (i.e. not
76
74
from generated code or from helper.c) */
77
75
/* XXX: fix it to restore all registers */
78
void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx,
76
void tlb_fill(CPUARMState *env1, target_ulong addr, int is_write, int mmu_idx,
81
79
TranslationBlock *tb;
80
CPUARMState *saved_env;
89
86
if (unlikely(ret)) {
91
88
/* now we have a real cpu fault */
92
pc = (unsigned long)retaddr;
89
tb = tb_find_pc(retaddr);
95
91
/* the PC is inside the translated code. It means that we have
96
92
a virtual CPU fault */
97
cpu_restore_state(tb, env, pc);
93
cpu_restore_state(tb, env, retaddr);
100
96
raise_exception(env->exception_index);
105
void HELPER(set_cp)(CPUState *env, uint32_t insn, uint32_t val)
107
int cp_num = (insn >> 8) & 0xf;
108
int cp_info = (insn >> 5) & 7;
109
int src = (insn >> 16) & 0xf;
110
int operand = insn & 0xf;
112
if (env->cp[cp_num].cp_write)
113
env->cp[cp_num].cp_write(env->cp[cp_num].opaque,
114
cp_info, src, operand, val, GETPC());
117
uint32_t HELPER(get_cp)(CPUState *env, uint32_t insn)
119
int cp_num = (insn >> 8) & 0xf;
120
int cp_info = (insn >> 5) & 7;
121
int dest = (insn >> 16) & 0xf;
122
int operand = insn & 0xf;
124
if (env->cp[cp_num].cp_read)
125
return env->cp[cp_num].cp_read(env->cp[cp_num].opaque,
126
cp_info, dest, operand, GETPC());
132
void HELPER(set_cp)(CPUState *env, uint32_t insn, uint32_t val)
134
int op1 = (insn >> 8) & 0xf;
135
cpu_abort(env, "cp%i insn %08x\n", op1, insn);
139
uint32_t HELPER(get_cp)(CPUState *env, uint32_t insn)
141
int op1 = (insn >> 8) & 0xf;
142
cpu_abort(env, "cp%i insn %08x\n", op1, insn);
148
/* FIXME: Pass an axplicit pointer to QF to CPUState, and move saturating
102
/* FIXME: Pass an axplicit pointer to QF to CPUARMState, and move saturating
149
103
instructions into helper.c */
150
104
uint32_t HELPER(add_setq)(uint32_t a, uint32_t b)
288
void HELPER(set_cp_reg)(CPUARMState *env, void *rip, uint32_t value)
290
const ARMCPRegInfo *ri = rip;
291
int excp = ri->writefn(env, ri, value);
293
raise_exception(excp);
297
uint32_t HELPER(get_cp_reg)(CPUARMState *env, void *rip)
299
const ARMCPRegInfo *ri = rip;
301
int excp = ri->readfn(env, ri, &value);
303
raise_exception(excp);
308
void HELPER(set_cp_reg64)(CPUARMState *env, void *rip, uint64_t value)
310
const ARMCPRegInfo *ri = rip;
311
int excp = ri->writefn(env, ri, value);
313
raise_exception(excp);
317
uint64_t HELPER(get_cp_reg64)(CPUARMState *env, void *rip)
319
const ARMCPRegInfo *ri = rip;
321
int excp = ri->readfn(env, ri, &value);
323
raise_exception(excp);
334
328
/* ??? Flag setting arithmetic is awkward because we need to do comparisons.
335
329
The only way to do that in TCG is a conditional branch, which clobbers
336
330
all our temporaries. For now implement these as helper functions. */