From 0fc68742a3d96da5dbe5f702b60a899991c79f0f Mon Sep 17 00:00:00 2001 From: fridtjof Date: Wed, 13 Aug 2025 01:39:35 +0200 Subject: [PATCH] wip! cpu: implement some ops that previously crashed because they're not there --- target/cr16c/cpu.c | 15 ++++++++++++++- target/cr16c/cpu.h | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/target/cr16c/cpu.c b/target/cr16c/cpu.c index 3f882573a6..ee2bce1282 100644 --- a/target/cr16c/cpu.c +++ b/target/cr16c/cpu.c @@ -118,6 +118,12 @@ static void cr16c_cpu_set_pc(CPUState *cs, vaddr value) cpu->env.pc = value; } +static vaddr cr16c_cpu_get_pc(CPUState *cs) +{ + CR16CCPU *cpu = CR16C_CPU(cs); + return cpu->env.pc; +} + static int cr16c_cpu_mmu_index(CPUState *cs, bool ifetch) { return 0; @@ -153,6 +159,12 @@ bool cr16c_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, return true; } +void cr16c_restore_state_to_opc(CPUState *cpu, const TranslationBlock *tb, + const uint64_t *data) { + qemu_printf("idk what im doing!!!!!!\n"); + // TODO figure out what this is supposed to do and implement it +} + #include "hw/core/sysemu-cpu-ops.h" @@ -168,12 +180,12 @@ static const struct TCGCPUOps cr16c_tcg_ops = { .cpu_exec_reset = cpu_reset, .translate_code = cr16c_translate_code, .get_tb_cpu_state = cr16c_cpu_get_tb_cpu_state, + .restore_state_to_opc = cr16c_restore_state_to_opc, .tlb_fill = cr16c_cpu_tlb_fill, .pointer_wrap = cpu_pointer_wrap_notreached, .cpu_exec_halt = cr16c_cpu_has_work, }; - static void cr16c_cpu_class_init(ObjectClass *oc, const void *data) { CR16CCPUClass *acc = CR16C_CPU_CLASS(oc); @@ -188,6 +200,7 @@ static void cr16c_cpu_class_init(ObjectClass *oc, const void *data) cc->dump_state = cr16c_cpu_dump_state; cc->set_pc = cr16c_cpu_set_pc; + cc->get_pc = cr16c_cpu_get_pc; cc->sysemu_ops = &cr16c_sysemu_ops; cc->disas_set_info = cr16c_cpu_disas_set_info; cc->tcg_ops = &cr16c_tcg_ops; diff --git a/target/cr16c/cpu.h b/target/cr16c/cpu.h index f6f54aee57..b43969e866 100644 --- a/target/cr16c/cpu.h +++ b/target/cr16c/cpu.h @@ -60,4 +60,7 @@ void cr16c_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb); void cr16c_translate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, vaddr pc, void *host_pc); +void cr16c_restore_state_to_opc(CPUState *cpu, const TranslationBlock *tb, + const uint64_t *data); + #endif // !QEMU_CR16C_CPU_H