aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/hvm/vmx
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2013-09-09 10:23:32 +0200
committerJan Beulich <jbeulich@suse.com>2013-09-09 10:23:32 +0200
commitcfd54835e6e8a28c743dc7d67c662d151ab4923a (patch)
tree6a6b59ceee96950731f928c70c81581d4b1bf54d /xen/arch/x86/hvm/vmx
parentb0df10407df96fe25f3c1a2bffc4be0696d328b4 (diff)
downloadxen-cfd54835e6e8a28c743dc7d67c662d151ab4923a.tar.gz
xen-cfd54835e6e8a28c743dc7d67c662d151ab4923a.tar.bz2
xen-cfd54835e6e8a28c743dc7d67c662d151ab4923a.zip
VMX: use proper instruction mnemonics if assembler supports them
With the hex byte emission we were taking away a good part of flexibility from the compiler, as for simplicity reasons these were built using fixed operands. All half way modern build environments would allow using the mnemonics (but we can't disable the hex variants yet, since the binutils around at the time gcc 4.1 got released didn't support these yet). I didn't convert __vmread() yet because that would, just like for __vmread_safe(), imply converting to a macro so that the output operand can be the caller supplied variable rather than an intermediate one. As that would require touching all invocation points of __vmread() (of which there are quite a few), I'd first like to be certain the approach is acceptable; the main question being whether the now conditional code might be considered to cause future maintenance issues, and the second being that of parameter/argument ordering (here I made __vmread_safe() match __vmwrite(), but one could also take the position that read and write should use the inverse order of one another, in line with the actual instruction operands). Additionally I was quite puzzled to find that all the asm()-s involved here have memory clobbers - what are they needed for? Or can they be dropped at least in some cases? Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Tim Deegan <tim@xen.org>
Diffstat (limited to 'xen/arch/x86/hvm/vmx')
-rw-r--r--xen/arch/x86/hvm/vmx/vmcs.c7
-rw-r--r--xen/arch/x86/hvm/vmx/vvmx.c8
2 files changed, 6 insertions, 9 deletions
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 31347bb014..0b40b546f6 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -1292,12 +1292,11 @@ void vmx_do_resume(struct vcpu *v)
reset_stack_and_jump(vmx_asm_do_vmentry);
}
-static unsigned long vmr(unsigned long field)
+static inline unsigned long vmr(unsigned long field)
{
- int rc;
unsigned long val;
- val = __vmread_safe(field, &rc);
- return rc ? 0 : val;
+
+ return __vmread_safe(field, &val) ? val : 0;
}
static void vmx_dump_sel(char *name, uint32_t selector)
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index cecc72f053..5ef5ad7385 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -963,13 +963,11 @@ fallback:
vvmcs_to_shadow(vvmcs, field[i]);
}
-static void shadow_to_vvmcs(void *vvmcs, unsigned int field)
+static inline void shadow_to_vvmcs(void *vvmcs, unsigned int field)
{
- u64 value;
- int rc;
+ unsigned long value;
- value = __vmread_safe(field, &rc);
- if ( !rc )
+ if ( __vmread_safe(field, &value) )
__set_vvmcs(vvmcs, field, value);
}