From 680688040fc26d17a49a9663fbbd6a716c6247b6 Mon Sep 17 00:00:00 2001 From: Alexey Kardashevskiy Date: Thu, 19 Nov 2020 21:01:35 +1100 Subject: pkg/ifuzz/powerpc: add powerpc support This adds KVM's syz_kvm_setup_cpu pseudo syscall. This adds placeholder for options (none implemented yet). This adds instruction generator for ifuzz; this also adds a few pseudo instructions to simulate super/hyper/ultracalls (a PPC64/pseries platform thing). The insns.go is generated from PowerISA_public.v3.0B.pdf [1] by a horrendous python3 script on top of pdftotext. The ISA covers POWER9 which is the latest available POWER CPU at the moment. The next ISA for POWER10 is quite different and we will deal with it later. The // comment after every instruction is a fixed opcode list for verification purposes. This does not define DecodeExt as there is no obvious replacement of the Intel XED library for POWERPC (gapstone-capstone, later, may be). [1] https://openpowerfoundation.org/?resource_lib=power-isa-version-3-0 Signed-off-by: Alexey Kardashevskiy --- sys/linux/dev_kvm.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'sys/linux/dev_kvm.txt') diff --git a/sys/linux/dev_kvm.txt b/sys/linux/dev_kvm.txt index a38da6086..78615a8b6 100644 --- a/sys/linux/dev_kvm.txt +++ b/sys/linux/dev_kvm.txt @@ -157,6 +157,7 @@ kvm_x86_rflags = 1, 2, 4, 16, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, # The interface is designed for extensibility so that addition of new options does not invalidate all existing programs. syz_kvm_setup_cpu$x86(fd fd_kvmvm, cpufd fd_kvmcpu, usermem vma[24], text ptr[in, array[kvm_text_x86, 1]], ntext len[text], flags flags[kvm_setup_flags], opts ptr[in, array[kvm_setup_opt_x86, 0:2]], nopt len[opts]) syz_kvm_setup_cpu$arm64(fd fd_kvmvm, cpufd fd_kvmcpu, usermem vma[24], text ptr[in, array[kvm_text_arm64, 1]], ntext len[text], flags const[0], opts ptr[in, array[kvm_setup_opt_arm64, 1]], nopt len[opts]) +syz_kvm_setup_cpu$ppc64(fd fd_kvmvm, cpufd fd_kvmcpu, usermem vma[24], text ptr[in, array[kvm_text_ppc64, 1]], ntext len[text], flags const[0], opts ptr[in, array[kvm_setup_opt_ppc64, 1]], nopt len[opts]) kvm_text_x86 [ textreal kvm_text_x86_real @@ -195,6 +196,12 @@ kvm_text_arm64 { size len[text, intptr] } +kvm_text_ppc64 { + typ const[0, intptr] + text ptr[in, text[ppc64]] + size len[text, intptr] +} + kvm_setup_opt_x86 [ cr0 kvm_setup_opt_cr0 cr4 kvm_setup_opt_cr4 @@ -271,6 +278,17 @@ kvm_setup_opt_feature { val flags[kvm_vcpu_features_arm64, int64] } +kvm_setup_opt_ppc64 [ +# unions need at least 2 fields, but we have only 1 now, but we want to have it as union for future extention + featur1 kvm_setup_opt_ppc64_feature + featur2 kvm_setup_opt_ppc64_feature +] + +kvm_setup_opt_ppc64_feature { + typ const[1, int64] + val int64 +} + kvm_setup_flags = KVM_SETUP_PAGING, KVM_SETUP_PAE, KVM_SETUP_PROTECTED, KVM_SETUP_CPL3, KVM_SETUP_VIRT86, KVM_SETUP_SMM, KVM_SETUP_VM define KVM_SETUP_PAGING (1<<0) -- cgit mrf-deployment