3 #include "dyngen-exec.h"
5 #include "host-utils.h"
7 #include "hw/lm32_pic.h"
8 #include "hw/lm32_juart.h"
10 #if !defined(CONFIG_USER_ONLY)
11 #define MMUSUFFIX _mmu
13 #include "softmmu_template.h"
15 #include "softmmu_template.h"
17 #include "softmmu_template.h"
19 #include "softmmu_template.h"
21 void helper_raise_exception(uint32_t index
)
23 env
->exception_index
= index
;
30 env
->exception_index
= EXCP_HLT
;
34 void helper_wcsr_im(uint32_t im
)
36 lm32_pic_set_im(env
->pic_state
, im
);
39 void helper_wcsr_ip(uint32_t im
)
41 lm32_pic_set_ip(env
->pic_state
, im
);
44 void helper_wcsr_jtx(uint32_t jtx
)
46 lm32_juart_set_jtx(env
->juart_state
, jtx
);
49 void helper_wcsr_jrx(uint32_t jrx
)
51 lm32_juart_set_jrx(env
->juart_state
, jrx
);
54 uint32_t helper_rcsr_im(void)
56 return lm32_pic_get_im(env
->pic_state
);
59 uint32_t helper_rcsr_ip(void)
61 return lm32_pic_get_ip(env
->pic_state
);
64 uint32_t helper_rcsr_jtx(void)
66 return lm32_juart_get_jtx(env
->juart_state
);
69 uint32_t helper_rcsr_jrx(void)
71 return lm32_juart_get_jrx(env
->juart_state
);
74 /* Try to fill the TLB and return an exception if error. If retaddr is
75 NULL, it means that the function was called in C code (i.e. not
76 from generated code or from helper.c) */
77 /* XXX: fix it to restore all registers */
78 void tlb_fill(target_ulong addr
, int is_write
, int mmu_idx
, void *retaddr
)
85 /* XXX: hack to restore env in all cases, even if not called from
90 ret
= cpu_lm32_handle_mmu_fault(env
, addr
, is_write
, mmu_idx
, 1);
93 /* now we have a real cpu fault */
94 pc
= (unsigned long)retaddr
;
97 /* the PC is inside the translated code. It means that we have
98 a virtual CPU fault */
99 cpu_restore_state(tb
, env
, pc
);