monitor/qmp: Update comment for commit 4eaca8de268
[qemu/armbru.git] / target / lm32 / op_helper.c
blobe39fcd56473da084d82d3827bee5dcd7bca577ed
1 #include "qemu/osdep.h"
2 #include "cpu.h"
3 #include "exec/helper-proto.h"
4 #include "qemu/host-utils.h"
5 #include "qemu/main-loop.h"
6 #include "sysemu/runstate.h"
8 #include "hw/lm32/lm32_pic.h"
9 #include "hw/char/lm32_juart.h"
11 #include "exec/exec-all.h"
12 #include "exec/cpu_ldst.h"
14 #ifndef CONFIG_USER_ONLY
15 #endif
17 #if !defined(CONFIG_USER_ONLY)
18 void raise_exception(CPULM32State *env, int index)
20 CPUState *cs = env_cpu(env);
22 cs->exception_index = index;
23 cpu_loop_exit(cs);
26 void HELPER(raise_exception)(CPULM32State *env, uint32_t index)
28 raise_exception(env, index);
31 void HELPER(hlt)(CPULM32State *env)
33 CPUState *cs = env_cpu(env);
35 cs->halted = 1;
36 cs->exception_index = EXCP_HLT;
37 cpu_loop_exit(cs);
40 void HELPER(ill)(CPULM32State *env)
42 #ifndef CONFIG_USER_ONLY
43 CPUState *cs = env_cpu(env);
44 fprintf(stderr, "VM paused due to illegal instruction. "
45 "Connect a debugger or switch to the monitor console "
46 "to find out more.\n");
47 vm_stop(RUN_STATE_PAUSED);
48 cs->halted = 1;
49 raise_exception(env, EXCP_HALTED);
50 #endif
53 void HELPER(wcsr_bp)(CPULM32State *env, uint32_t bp, uint32_t idx)
55 uint32_t addr = bp & ~1;
57 assert(idx < 4);
59 env->bp[idx] = bp;
60 lm32_breakpoint_remove(env, idx);
61 if (bp & 1) {
62 lm32_breakpoint_insert(env, idx, addr);
66 void HELPER(wcsr_wp)(CPULM32State *env, uint32_t wp, uint32_t idx)
68 lm32_wp_t wp_type;
70 assert(idx < 4);
72 env->wp[idx] = wp;
74 wp_type = lm32_wp_type(env->dc, idx);
75 lm32_watchpoint_remove(env, idx);
76 if (wp_type != LM32_WP_DISABLED) {
77 lm32_watchpoint_insert(env, idx, wp, wp_type);
81 void HELPER(wcsr_dc)(CPULM32State *env, uint32_t dc)
83 uint32_t old_dc;
84 int i;
85 lm32_wp_t old_type;
86 lm32_wp_t new_type;
88 old_dc = env->dc;
89 env->dc = dc;
91 for (i = 0; i < 4; i++) {
92 old_type = lm32_wp_type(old_dc, i);
93 new_type = lm32_wp_type(dc, i);
95 if (old_type != new_type) {
96 lm32_watchpoint_remove(env, i);
97 if (new_type != LM32_WP_DISABLED) {
98 lm32_watchpoint_insert(env, i, env->wp[i], new_type);
104 void HELPER(wcsr_im)(CPULM32State *env, uint32_t im)
106 qemu_mutex_lock_iothread();
107 lm32_pic_set_im(env->pic_state, im);
108 qemu_mutex_unlock_iothread();
111 void HELPER(wcsr_ip)(CPULM32State *env, uint32_t im)
113 qemu_mutex_lock_iothread();
114 lm32_pic_set_ip(env->pic_state, im);
115 qemu_mutex_unlock_iothread();
118 void HELPER(wcsr_jtx)(CPULM32State *env, uint32_t jtx)
120 lm32_juart_set_jtx(env->juart_state, jtx);
123 void HELPER(wcsr_jrx)(CPULM32State *env, uint32_t jrx)
125 lm32_juart_set_jrx(env->juart_state, jrx);
128 uint32_t HELPER(rcsr_im)(CPULM32State *env)
130 return lm32_pic_get_im(env->pic_state);
133 uint32_t HELPER(rcsr_ip)(CPULM32State *env)
135 return lm32_pic_get_ip(env->pic_state);
138 uint32_t HELPER(rcsr_jtx)(CPULM32State *env)
140 return lm32_juart_get_jtx(env->juart_state);
143 uint32_t HELPER(rcsr_jrx)(CPULM32State *env)
145 return lm32_juart_get_jrx(env->juart_state);
147 #endif