]> git.proxmox.com Git - qemu.git/blob - target-lm32/op_helper.c
qdev-properties-system.c: Allow vlan or netdev for -device, not both
[qemu.git] / target-lm32 / op_helper.c
1 #include <assert.h>
2 #include "cpu.h"
3 #include "helper.h"
4 #include "qemu/host-utils.h"
5
6 #include "hw/lm32/lm32_pic.h"
7 #include "hw/char/lm32_juart.h"
8
9 #include "exec/softmmu_exec.h"
10
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"
21
22 void HELPER(raise_exception)(CPULM32State *env, uint32_t index)
23 {
24 env->exception_index = index;
25 cpu_loop_exit(env);
26 }
27
28 void HELPER(hlt)(CPULM32State *env)
29 {
30 CPUState *cs = CPU(lm32_env_get_cpu(env));
31
32 cs->halted = 1;
33 env->exception_index = EXCP_HLT;
34 cpu_loop_exit(env);
35 }
36
37 void HELPER(wcsr_im)(CPULM32State *env, uint32_t im)
38 {
39 lm32_pic_set_im(env->pic_state, im);
40 }
41
42 void HELPER(wcsr_ip)(CPULM32State *env, uint32_t im)
43 {
44 lm32_pic_set_ip(env->pic_state, im);
45 }
46
47 void HELPER(wcsr_jtx)(CPULM32State *env, uint32_t jtx)
48 {
49 lm32_juart_set_jtx(env->juart_state, jtx);
50 }
51
52 void HELPER(wcsr_jrx)(CPULM32State *env, uint32_t jrx)
53 {
54 lm32_juart_set_jrx(env->juart_state, jrx);
55 }
56
57 uint32_t HELPER(rcsr_im)(CPULM32State *env)
58 {
59 return lm32_pic_get_im(env->pic_state);
60 }
61
62 uint32_t HELPER(rcsr_ip)(CPULM32State *env)
63 {
64 return lm32_pic_get_ip(env->pic_state);
65 }
66
67 uint32_t HELPER(rcsr_jtx)(CPULM32State *env)
68 {
69 return lm32_juart_get_jtx(env->juart_state);
70 }
71
72 uint32_t HELPER(rcsr_jrx)(CPULM32State *env)
73 {
74 return lm32_juart_get_jrx(env->juart_state);
75 }
76
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)
82 {
83 int ret;
84
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);
90 }
91 cpu_loop_exit(env);
92 }
93 }
94 #endif
95