wip! cpu: implement some ops that previously crashed because they're not there

This commit is contained in:
fridtjof 2025-08-13 01:39:35 +02:00
parent d3c73feda0
commit 0fc68742a3
2 changed files with 17 additions and 1 deletions

View file

@ -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;

View file

@ -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