From e00224d9ff393517c827e5e827f7638a9eaff812 Mon Sep 17 00:00:00 2001 From: Alexey Kardashevskiy Date: Wed, 14 Jul 2021 15:19:57 +1000 Subject: executor/common_kvm_ppc64: fix KVM support Turns out the ifuzz on powerpc did not ever properly work. This fixes syz_kvm_setup_cpu$ppc64: Enable the PAPR KVM capability (otherwise KVM_RUN fails right away). Finish generated sequences with the software debug breakpoint as there is no x86's "hlt" variant on POWER and otherwise KVM won't exit. Add exception handlers, use the software debug breakpoint instruction to trigger immediate exit from KVM with the only exception of the decrementer interrupt handler (timer) to recharge the timer and continue. Define and use endianness selection flag (Big vs. Little endian). Define the code generator similar to kvm_gen.cc which for now contains 2 simple tests and the decrementer interrupt handler code. Add test cases to the executor so "bin/linux_ppc64le/syz-executor test" can run some sensible tests. The tests copy 0xbadc0de around similar to x86 and uses gpr[3] is a return value register (similar to EAX). Signed-off-by: Alexey Kardashevskiy --- executor/kvm_gen.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'executor/kvm_gen.cc') diff --git a/executor/kvm_gen.cc b/executor/kvm_gen.cc index 7df6e9bd7..bfbb0e8e7 100644 --- a/executor/kvm_gen.cc +++ b/executor/kvm_gen.cc @@ -29,6 +29,10 @@ int main() PRINT(kvm_asm64_init_vm); PRINT(kvm_asm64_vm_exit); PRINT(kvm_asm64_cpl3); +#elif GOARCH_ppc64le + PRINT(kvm_ppc64_mr); + PRINT(kvm_ppc64_ld); + PRINT(kvm_ppc64_recharge_dec); #endif return 0; } -- cgit mrf-deployment