X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=target-lm32%2Fhelper.c;h=d76ea3fe096a595da27aff0f447375a8355e0b6c;hb=1de7afc984b49af164e2619e6850b9732b173b34;hp=e79428d8e01894e03ff1bc7f530998276f614feb;hpb=2b41f10e186ccb4f0058815161586f8d6d006ea3;p=qemu.git
diff --git a/target-lm32/helper.c b/target-lm32/helper.c
index e79428d8e..d76ea3fe0 100644
--- a/target-lm32/helper.c
+++ b/target-lm32/helper.c
@@ -17,16 +17,11 @@
* License along with this library; if not, see .
*/
-#include
-#include
-#include
-
-#include "config.h"
#include "cpu.h"
-#include "host-utils.h"
+#include "qemu/host-utils.h"
-int cpu_lm32_handle_mmu_fault(CPUState *env, target_ulong address, int rw,
- int mmu_idx, int is_softmmu)
+int cpu_lm32_handle_mmu_fault(CPULM32State *env, target_ulong address, int rw,
+ int mmu_idx)
{
int prot;
@@ -42,12 +37,12 @@ int cpu_lm32_handle_mmu_fault(CPUState *env, target_ulong address, int rw,
return 0;
}
-target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
+hwaddr cpu_get_phys_page_debug(CPULM32State *env, target_ulong addr)
{
return addr & TARGET_PAGE_MASK;
}
-void do_interrupt(CPUState *env)
+void do_interrupt(CPULM32State *env)
{
qemu_log_mask(CPU_LOG_INT,
"exception at pc=%x type=%x\n", env->pc, env->exception_index);
@@ -197,9 +192,10 @@ static uint32_t cfg_by_def(const LM32Def *def)
return cfg;
}
-CPUState *cpu_lm32_init(const char *cpu_model)
+LM32CPU *cpu_lm32_init(const char *cpu_model)
{
- CPUState *env;
+ LM32CPU *cpu;
+ CPULM32State *env;
const LM32Def *def;
static int tcg_initialized;
@@ -208,29 +204,28 @@ CPUState *cpu_lm32_init(const char *cpu_model)
return NULL;
}
- env = qemu_mallocz(sizeof(CPUState));
+ cpu = LM32_CPU(object_new(TYPE_LM32_CPU));
+ env = &cpu->env;
env->features = def->features;
env->num_bps = def->num_breakpoints;
env->num_wps = def->num_watchpoints;
env->cfg = cfg_by_def(def);
- env->flags = 0;
- cpu_exec_init(env);
- cpu_reset(env);
+ qemu_init_vcpu(env);
- if (!tcg_initialized) {
+ if (tcg_enabled() && !tcg_initialized) {
tcg_initialized = 1;
lm32_translate_init();
}
- return env;
+ return cpu;
}
/* Some soc ignores the MSB on the address bus. Thus creating a shadow memory
* area. As a general rule, 0x00000000-0x7fffffff is cached, whereas
* 0x80000000-0xffffffff is not cached and used to access IO devices. */
-void cpu_lm32_set_phys_msb_ignore(CPUState *env, int value)
+void cpu_lm32_set_phys_msb_ignore(CPULM32State *env, int value)
{
if (value) {
env->flags |= LM32_FLAG_IGNORE_MSB;
@@ -238,17 +233,3 @@ void cpu_lm32_set_phys_msb_ignore(CPUState *env, int value)
env->flags &= ~LM32_FLAG_IGNORE_MSB;
}
}
-
-void cpu_reset(CPUState *env)
-{
- if (qemu_loglevel_mask(CPU_LOG_RESET)) {
- qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
- log_cpu_state(env, 0);
- }
-
- tlb_flush(env, 1);
-
- /* reset cpu state */
- memset(env, 0, offsetof(CPULM32State, breakpoints));
-}
-