Store VNC auth scheme per-client as well as per-server
[qemu/ar7.git] / target-lm32 / op_helper.c
bloba34cecd2951c6bcb974e38799345307b162120f4
1 #include <assert.h>
2 #include "exec.h"
3 #include "helper.h"
4 #include "host-utils.h"
6 #include "hw/lm32_pic.h"
7 #include "hw/lm32_juart.h"
9 #if !defined(CONFIG_USER_ONLY)
10 #define MMUSUFFIX _mmu
11 #define SHIFT 0
12 #include "softmmu_template.h"
13 #define SHIFT 1
14 #include "softmmu_template.h"
15 #define SHIFT 2
16 #include "softmmu_template.h"
17 #define SHIFT 3
18 #include "softmmu_template.h"
20 void helper_raise_exception(uint32_t index)
22 env->exception_index = index;
23 cpu_loop_exit(env);
26 void helper_hlt(void)
28 env->halted = 1;
29 env->exception_index = EXCP_HLT;
30 cpu_loop_exit(env);
33 void helper_wcsr_im(uint32_t im)
35 lm32_pic_set_im(env->pic_state, im);
38 void helper_wcsr_ip(uint32_t im)
40 lm32_pic_set_ip(env->pic_state, im);
43 void helper_wcsr_jtx(uint32_t jtx)
45 lm32_juart_set_jtx(env->juart_state, jtx);
48 void helper_wcsr_jrx(uint32_t jrx)
50 lm32_juart_set_jrx(env->juart_state, jrx);
53 uint32_t helper_rcsr_im(void)
55 return lm32_pic_get_im(env->pic_state);
58 uint32_t helper_rcsr_ip(void)
60 return lm32_pic_get_ip(env->pic_state);
63 uint32_t helper_rcsr_jtx(void)
65 return lm32_juart_get_jtx(env->juart_state);
68 uint32_t helper_rcsr_jrx(void)
70 return lm32_juart_get_jrx(env->juart_state);
73 /* Try to fill the TLB and return an exception if error. If retaddr is
74 NULL, it means that the function was called in C code (i.e. not
75 from generated code or from helper.c) */
76 /* XXX: fix it to restore all registers */
77 void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr)
79 TranslationBlock *tb;
80 CPUState *saved_env;
81 unsigned long pc;
82 int ret;
84 /* XXX: hack to restore env in all cases, even if not called from
85 generated code */
86 saved_env = env;
87 env = cpu_single_env;
89 ret = cpu_lm32_handle_mmu_fault(env, addr, is_write, mmu_idx, 1);
90 if (unlikely(ret)) {
91 if (retaddr) {
92 /* now we have a real cpu fault */
93 pc = (unsigned long)retaddr;
94 tb = tb_find_pc(pc);
95 if (tb) {
96 /* the PC is inside the translated code. It means that we have
97 a virtual CPU fault */
98 cpu_restore_state(tb, env, pc);
101 cpu_loop_exit(env);
103 env = saved_env;
105 #endif