[PATCH 7/8] kvm: decode the argument for KVM_{SET, GET}_SREGS ioctl command
Dmitry V. Levin
ldv at altlinux.org
Fri Dec 1 07:21:43 UTC 2017
On Fri, Dec 01, 2017 at 02:45:57PM +0900, Masatake YAMATO wrote:
> * kvm.c (kvm_ioctl): Handle KVM_SET_SREGS and KVM_GET_SREGES.
> (kvm_ioctl_decode_sregs): New function.
> (kvm_ioctl_decode_regs_dtable): New function.
> (kvm_ioctl_decode_regs_segment): New function.
>
> Signed-off-by: Masatake YAMATO <yamato at redhat.com>
> ---
> kvm.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 82 insertions(+)
>
> diff --git a/kvm.c b/kvm.c
> index 69a8c97a..b0eb1377 100644
> --- a/kvm.c
> +++ b/kvm.c
> @@ -121,6 +121,85 @@ kvm_ioctl_decode_regs(struct tcb *const tcp, const unsigned int code, const kern
> #endif
> }
>
> +#ifdef X86_64
> +static void
> +kvm_ioctl_decode_regs_segment(const char *prefix, struct kvm_segment *segment)
> +{
> + tprints(prefix);
> + PRINT_FIELD_X("={", *segment, base);
> + PRINT_FIELD_U(", ", *segment, limit);
> + PRINT_FIELD_U(", ", *segment, selector);
> + PRINT_FIELD_U(", ", *segment, type);
> + PRINT_FIELD_U(", ", *segment, present);
> + PRINT_FIELD_U(", ", *segment, dpl);
> + PRINT_FIELD_U(", ", *segment, db);
> + PRINT_FIELD_U(", ", *segment, s);
> + PRINT_FIELD_U(", ", *segment, l);
> + PRINT_FIELD_U(", ", *segment, g);
> + PRINT_FIELD_U(", ", *segment, avl);
> + tprints("}");
> +}
> +
> +static void
> +kvm_ioctl_decode_regs_dtable(const char *prefix, struct kvm_dtable *dtable)
> +{
> + tprints(prefix);
> + PRINT_FIELD_X("={", *dtable, base);
> + PRINT_FIELD_U(", ", *dtable, limit);
> + tprints("}");
> +}
> +#endif
> +
> +static int
> +kvm_ioctl_decode_sregs(struct tcb *const tcp, const unsigned int code, const kernel_ulong_t arg)
> +{
> + struct kvm_sregs sregs;
> +
> +#ifdef X86_64
The same reasoning as in case of struct kvm_regs applies here as well.
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20171201/3ada4e76/attachment.bin>
More information about the Strace-devel
mailing list