mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 09:47:44 +00:00
HV:treewide: Add exec_vmread16 and exec_vmwrite16 functions
In the hypervisor, VMCS fields include 16-bit fields, 32-bit fields, 64-bit fields and natural-width fields. In the current implement, no exec_vmread16/exec_vmwrite16 is for accessing 16-bit fields. So there are many type casting for the return value and parameters vmread/vmwrite operations. Create exec_vmread16 and exec_vmwrite16 functions to access 16-bit fields in VMCS; Update related variables type for vmread/vmwrite operations; Update related caller according to VMCS fields size. V1--V2: This is new part of this patch serial to only update 16-bit vmread/vmread opertions and related caller. V2--V3: Add "hu" for uint16_t argument in log function; Add comments for function get_vmcs_field; Update related variables type for exec_vmread16; Rename temp variable 'low' into 'value'. V3-->V4: Few updates for exec_vmread16. V4-->V5: Few updates for coding style; Replace "hux" with "hu" in log function for 16-bit variable. V5-->V6: CPU_REG_64BIT_LAST is used in the vm_get_register and vm_set_register to make condition statement more understandable. Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com> Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
@@ -14,11 +14,11 @@
|
||||
|
||||
bool is_hypercall_from_ring0(void)
|
||||
{
|
||||
uint64_t cs_sel;
|
||||
uint16_t cs_sel;
|
||||
|
||||
cs_sel = exec_vmread(VMX_GUEST_CS_SEL);
|
||||
cs_sel = exec_vmread16(VMX_GUEST_CS_SEL);
|
||||
/* cs_selector[1:0] is CPL */
|
||||
if ((cs_sel & 0x3UL) == 0) {
|
||||
if ((cs_sel & 0x3U) == 0U) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user