roms: Flush icache when writing roms to guest memory
[qemu/ar7.git] / target-lm32 / op_helper.c
blob8f5ef554d5f5b5884df99b6cc6742795ac88bcc4
1 #include <assert.h>
2 #include "cpu.h"
3 #include "helper.h"
4 #include "qemu/host-utils.h"
6 #include "hw/lm32/lm32_pic.h"
7 #include "hw/char/lm32_juart.h"
9 #include "exec/softmmu_exec.h"
11 #if !defined(CONFIG_USER_ONLY)
12 #define MMUSUFFIX _mmu
13 #define SHIFT 0
14 #include "exec/softmmu_template.h"
15 #define SHIFT 1
16 #include "exec/softmmu_template.h"
17 #define SHIFT 2
18 #include "exec/softmmu_template.h"
19 #define SHIFT 3
20 #include "exec/softmmu_template.h"
22 void HELPER(raise_exception)(CPULM32State *env, uint32_t index)
24 env->exception_index = index;
25 cpu_loop_exit(env);
28 void HELPER(hlt)(CPULM32State *env)
30 CPUState *cs = CPU(lm32_env_get_cpu(env));
32 cs->halted = 1;
33 env->exception_index = EXCP_HLT;
34 cpu_loop_exit(env);
37 void HELPER(wcsr_im)(CPULM32State *env, uint32_t im)
39 lm32_pic_set_im(env->pic_state, im);
42 void HELPER(wcsr_ip)(CPULM32State *env, uint32_t im)
44 lm32_pic_set_ip(env->pic_state, im);
47 void HELPER(wcsr_jtx)(CPULM32State *env, uint32_t jtx)
49 lm32_juart_set_jtx(env->juart_state, jtx);
52 void HELPER(wcsr_jrx)(CPULM32State *env, uint32_t jrx)
54 lm32_juart_set_jrx(env->juart_state, jrx);
57 uint32_t HELPER(rcsr_im)(CPULM32State *env)
59 return lm32_pic_get_im(env->pic_state);
62 uint32_t HELPER(rcsr_ip)(CPULM32State *env)
64 return lm32_pic_get_ip(env->pic_state);
67 uint32_t HELPER(rcsr_jtx)(CPULM32State *env)
69 return lm32_juart_get_jtx(env->juart_state);
72 uint32_t HELPER(rcsr_jrx)(CPULM32State *env)
74 return lm32_juart_get_jrx(env->juart_state);
77 /* Try to fill the TLB and return an exception if error. If retaddr is
78 NULL, it means that the function was called in C code (i.e. not
79 from generated code or from helper.c) */
80 void tlb_fill(CPULM32State *env, target_ulong addr, int is_write, int mmu_idx,
81 uintptr_t retaddr)
83 int ret;
85 ret = cpu_lm32_handle_mmu_fault(env, addr, is_write, mmu_idx);
86 if (unlikely(ret)) {
87 if (retaddr) {
88 /* now we have a real cpu fault */
89 cpu_restore_state(env, retaddr);
91 cpu_loop_exit(env);
94 #endif