mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86/P2M: split a read_atomic() invocation
Misra C:2012 rule 13.6 takes issue with pfn_to_pdx() and mfn_x() uses (deep) inside sizeof(), as used by read_atomic(). Break out the MFN -> struct page_info * translation. No difference in generated code, except for a line number change. Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
1 parent
6621fa6708
commit
91ea85ec12
1 file changed
+3
-1
@@ -1332,6 +1332,7 @@ int set_shared_p2m_entry(struct domain *d, unsigned long gfn_l, mfn_t mfn)
|
||||
p2m_access_t a;
|
||||
p2m_type_t ot;
|
||||
mfn_t omfn;
|
||||
const struct page_info *pg;
|
||||
unsigned long pg_type;
|
||||
|
||||
if ( !paging_mode_translate(p2m->domain) )
|
||||
@@ -1345,7 +1346,8 @@ int set_shared_p2m_entry(struct domain *d, unsigned long gfn_l, mfn_t mfn)
|
||||
ASSERT(mfn_valid(omfn));
|
||||
/* Set the m2p entry to invalid only if there are no further type
|
||||
* refs to this page as shared */
|
||||
pg_type = read_atomic(&(mfn_to_page(omfn)->u.inuse.type_info));
|
||||
pg = mfn_to_page(omfn);
|
||||
pg_type = read_atomic(&pg->u.inuse.type_info);
|
||||
if ( (pg_type & PGT_count_mask) == 0
|
||||
|| (pg_type & PGT_type_mask) != PGT_shared_page )
|
||||
set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY);
|
||||
|
||||