On Fri, Dec 01, 2017 at 02:45:55PM +0900, Masatake YAMATO wrote: > * xlat/kvm_mem_flags.in: New file. > * kvm.c (kvm_ioctl): Handle KVM_SET_USER_MEMORY_REGION. > (kvm_ioctl_set_user_memory_region): New function. > (top-level): Include print_fields.h and xlat/kvm_mem_flags.h. > > Signed-off-by: Masatake YAMATO <yam...@redhat.com> > --- > kvm.c | 22 ++++++++++++++++++++++ > xlat/kvm_mem_flags.in | 2 ++ > 2 files changed, 24 insertions(+) > create mode 100644 xlat/kvm_mem_flags.in > > diff --git a/kvm.c b/kvm.c > index 1b21dab5..43746fef 100644 > --- a/kvm.c > +++ b/kvm.c > @@ -32,6 +32,7 @@ > > #ifdef HAVE_LINUX_KVM_H > #include <linux/kvm.h> > +#include "print_fields.h" > > static int > kvm_ioctl_create_vm(struct tcb *const tcp, const kernel_ulong_t arg) > @@ -52,6 +53,25 @@ kvm_ioctl_create_vcpu(struct tcb *const tcp, const > kernel_ulong_t arg) > return RVAL_IOCTL_DECODED | RVAL_FD; > } > > +#include "xlat/kvm_mem_flags.h" > +static int > +kvm_ioctl_set_user_memory_region(struct tcb *const tcp, const kernel_ulong_t > arg) > +{ > + struct kvm_userspace_memory_region u_memory_region; > + > + if (umove(tcp, arg, &u_memory_region) < 0) > + return RVAL_DECODED; > + > + PRINT_FIELD_U(", {", u_memory_region, slot);
This needs a slightly different code, e.g. tprints(", "); if (umove_or_printaddr(tcp, arg, &u_memory_region)) return RVAL_IOCTL_DECODED; PRINT_FIELD_U("{", u_memory_region, slot); because umove_or_printaddr performs verbose(tcp) check and prints the zero address nicely. -- ldv
signature.asc
Description: PGP signature
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel