mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
x86/shadow: Clean up the MMIO fastpath helpers
Use bool when appropriate, remove extraneous brackets and fix up comment style. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Wei Liu <wei.liu2@citrix.com> Reviewed-by: Tim Deegan <tim@xen.org>
This commit is contained in:
1 parent
c0bb03a5ef
commit
53d5467d09
1 file changed
+12
-10
@@ -294,9 +294,9 @@ void sh_destroy_monitor_table(struct vcpu *v, mfn_t mmfn);
|
||||
*/
|
||||
|
||||
#define SH_L1E_MAGIC 0xffffffff00000001ULL
|
||||
static inline int sh_l1e_is_magic(shadow_l1e_t sl1e)
|
||||
static inline bool sh_l1e_is_magic(shadow_l1e_t sl1e)
|
||||
{
|
||||
return ((sl1e.l1 & SH_L1E_MAGIC) == SH_L1E_MAGIC);
|
||||
return (sl1e.l1 & SH_L1E_MAGIC) == SH_L1E_MAGIC;
|
||||
}
|
||||
|
||||
/* Guest not present: a single magic value */
|
||||
@@ -305,15 +305,17 @@ static inline shadow_l1e_t sh_l1e_gnp(void)
|
||||
return (shadow_l1e_t){ -1ULL };
|
||||
}
|
||||
|
||||
static inline int sh_l1e_is_gnp(shadow_l1e_t sl1e)
|
||||
static inline bool sh_l1e_is_gnp(shadow_l1e_t sl1e)
|
||||
{
|
||||
return (sl1e.l1 == sh_l1e_gnp().l1);
|
||||
return sl1e.l1 == sh_l1e_gnp().l1;
|
||||
}
|
||||
|
||||
/* MMIO: an invalid PTE that contains the GFN of the equivalent guest l1e.
|
||||
/*
|
||||
* MMIO: an invalid PTE that contains the GFN of the equivalent guest l1e.
|
||||
* We store 28 bits of GFN in bits 4:32 of the entry.
|
||||
* The present bit is set, and the U/S and R/W bits are taken from the guest.
|
||||
* Bit 3 is always 0, to differentiate from gnp above. */
|
||||
* Bit 3 is always 0, to differentiate from gnp above.
|
||||
*/
|
||||
#define SH_L1E_MMIO_MAGIC 0xffffffff00000001ULL
|
||||
#define SH_L1E_MMIO_MAGIC_MASK 0xffffffff00000009ULL
|
||||
#define SH_L1E_MMIO_GFN_MASK 0x00000000fffffff0ULL
|
||||
@@ -325,9 +327,9 @@ static inline shadow_l1e_t sh_l1e_mmio(gfn_t gfn, u32 gflags)
|
||||
| (gflags & (_PAGE_USER|_PAGE_RW))) };
|
||||
}
|
||||
|
||||
static inline int sh_l1e_is_mmio(shadow_l1e_t sl1e)
|
||||
static inline bool sh_l1e_is_mmio(shadow_l1e_t sl1e)
|
||||
{
|
||||
return ((sl1e.l1 & SH_L1E_MMIO_MAGIC_MASK) == SH_L1E_MMIO_MAGIC);
|
||||
return (sl1e.l1 & SH_L1E_MMIO_MAGIC_MASK) == SH_L1E_MMIO_MAGIC;
|
||||
}
|
||||
|
||||
static inline gfn_t sh_l1e_mmio_get_gfn(shadow_l1e_t sl1e)
|
||||
@@ -335,9 +337,9 @@ static inline gfn_t sh_l1e_mmio_get_gfn(shadow_l1e_t sl1e)
|
||||
return _gfn(MASK_EXTR(sl1e.l1, SH_L1E_MMIO_GFN_MASK));
|
||||
}
|
||||
|
||||
static inline u32 sh_l1e_mmio_get_flags(shadow_l1e_t sl1e)
|
||||
static inline uint32_t sh_l1e_mmio_get_flags(shadow_l1e_t sl1e)
|
||||
{
|
||||
return (u32)((sl1e.l1 & (_PAGE_USER|_PAGE_RW)));
|
||||
return sl1e.l1 & (_PAGE_USER | _PAGE_RW);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||