acrn-hypervisor/hypervisor/include/hypervisor.h
Shiqing Gao 97aeb7f4ff hv: pgtable: fix 'Use of function like macro'
Convert HPA2HVA, HVA2HPA, GPA2HVA and HVA2GPA to inline functions.

v1 -> v2:
 * Modify the following statement.
   rsdp = biosacpi_search_rsdp((char *)hpa2hva((uint64_t)(*addr << 4)),
                                                                0x400);
   Instead of "(uint64_t)(*addr << 4)", "(uint64_t)(*addr) << 4U" would
   be clearer.

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2018-09-07 11:11:06 +08:00

46 lines
977 B
C

/*
* Copyright (C) 2018 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/************************************************************************
*
* FILE NAME
*
* hypervisor.h
*
* DESCRIPTION
*
* This file includes hypervisor used header files.
* It should be included in all the source files.
*
*
************************************************************************/
#ifndef HYPERVISOR_H
#define HYPERVISOR_H
/* Include config header file containing config options */
#include <types.h>
#include "acrn_common.h"
#include <acrn_hv_defs.h>
#include <hv_lib.h>
#include <hv_arch.h>
#include <hv_debug.h>
#ifndef ASSEMBLER
/* gpa --> hpa -->hva */
static inline void *gpa2hva(const struct vm *vm, uint64_t x)
{
return hpa2hva(gpa2hpa(vm, x));
}
static inline uint64_t hva2gpa(const struct vm *vm, void *x)
{
return hpa2gpa(vm, hva2hpa(x));
}
#endif /* !ASSEMBLER */
#endif /* HYPERVISOR_H */