[PATCH v3 1/5] x86: Add helper variables and functions to hold VMCSINFO

HATAYAMA Daisuke d.hatayama at jp.fujitsu.com
Thu Jun 28 21:54:42 EDT 2012


From: Yanfei Zhang <zhangyanfei at cn.fujitsu.com>
Subject: [PATCH v3 1/5] x86: Add helper variables and functions to hold VMCSINFO
Date: Wed, 27 Jun 2012 16:51:58 +0800

> This patch provides a set of variables to hold the VMCSINFO and also
> some helper functions to help fill the VMCSINFO.
> 
> Signed-off-by: zhangyanfei <zhangyanfei at cn.fujitsu.com>
> ---
>  arch/x86/include/asm/vmcsinfo.h |  219 ++++++++++++++++++++++
>  arch/x86/include/asm/vmx.h      |  158 +----------------
>  arch/x86/kernel/Makefile        |    1 +
>  arch/x86/kernel/vmcsinfo.c      |  381 +++++++++++++++++++++++++++++++++++++++
>  4 files changed, 603 insertions(+), 156 deletions(-)
>  create mode 100644 arch/x86/include/asm/vmcsinfo.h
>  create mode 100644 arch/x86/kernel/vmcsinfo.c
> 
> diff --git a/arch/x86/include/asm/vmcsinfo.h b/arch/x86/include/asm/vmcsinfo.h
> new file mode 100644
> index 0000000..4b9f56b
> --- /dev/null
> +++ b/arch/x86/include/asm/vmcsinfo.h
> @@ -0,0 +1,219 @@
> +#ifndef _ASM_X86_VMCSINFO_H
> +#define _ASM_X86_VMCSINFO_H
> +
> +#ifndef __ASSEMBLY__
> +#include <linux/types.h>
> +#include <linux/elf.h>
> +#include <linux/device.h>
> +
> +/* VMCS Encodings */
> +enum vmcs_field {
> +	VIRTUAL_PROCESSOR_ID            = 0x00000000,

<cut>

> +	HOST_RIP                        = 0x00006c16,
> +};
> +
> +/*
> + * vmcs field offsets.
> + */
> +struct vmcsinfo {
> +	u32 vmcs_revision_id;
> +	int filled;
> +	u16 vmcs_field_to_offset_table[HOST_RIP + 1];

HOST_RIP is so large that this array becomes large. Also there are
unused elements in this array because field encoding is not indexed
constantly.

Instead, how about defining the numbr of vmcs fields, 152?, as a
specific constant, indexing each fields using integers and newly
preparing index_to_field_table[]?

Thanks.
HATAYAMA, Daisuke




More information about the kexec mailing list