From dacb4d5126ef02521f7d611e54a67a3accbd4aea Mon Sep 17 00:00:00 2001 From: Steffen Schulz Date: Thu, 3 Feb 2022 13:57:12 -0800 Subject: [PATCH] initial support for Q35 platform Add option for "-machine kAFL64-Q35" Co-authored-by: Benoit Morgan --- hw/i386/pc_q35.c | 17 +++++++++++++++++ hw/isa/lpc_ich9.c | 1 + include/hw/i386/ich9.h | 5 +++++ 3 files changed, 23 insertions(+) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 385e5cffb1..e2c5a9bc6a 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -533,3 +533,20 @@ static void pc_q35_2_4_machine_options(MachineClass *m) DEFINE_Q35_MACHINE(v2_4, "pc-q35-2.4", NULL, pc_q35_2_4_machine_options); + +#ifdef QEMU_NYX +static void pc_kAFL64_vmx_v1_0_machine_options(MachineClass *m) +{ + pc_q35_4_2_machine_options(m); + m->alias = "kAFL64"; + //m->is_default = 1; + m->desc = "kAFL64 PC (Q35 + ICH9, 2009)"; +} + +static void kAFL64_init(MachineState *machine) +{ + pc_q35_init(machine); +} + +DEFINE_PC_MACHINE(v1, "kAFL64-Q35", kAFL64_init, pc_kAFL64_vmx_v1_0_machine_options); +#endif diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index 17c292e306..9e2d30b032 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -479,6 +479,7 @@ static void ich9_lpc_rcba_update(ICH9LPCState *lpc, uint32_t rcba_old) if (rcba_old & ICH9_LPC_RCBA_EN) { memory_region_del_subregion(get_system_memory(), &lpc->rcrb_mem); } + // Nyx snapshot reload fails here if ICH9_LPC_RCBA_EN=1 if (rcba & ICH9_LPC_RCBA_EN) { memory_region_add_subregion_overlap(get_system_memory(), rcba & ICH9_LPC_RCBA_BA_MASK, diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h index 72e803f6e2..df72577592 100644 --- a/include/hw/i386/ich9.h +++ b/include/hw/i386/ich9.h @@ -177,7 +177,12 @@ typedef struct ICH9LPCState { #define ICH9_LPC_RCBA 0xf0 #define ICH9_LPC_RCBA_BA_MASK Q35_MASK(32, 31, 14) +#ifdef QEMU_NYX +// Nyx snapshot restore fails on this +#define ICH9_LPC_RCBA_EN 0x0 +#else #define ICH9_LPC_RCBA_EN 0x1 +#endif #define ICH9_LPC_RCBA_DEFAULT 0x0 #define ICH9_LPC_PIC_NUM_PINS 16