[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v1 12/21] Ovmf/Xen: fix pointer to int cast in XenBusDxe
On 01/23/15 16:03, Ard Biesheuvel wrote: > On ARM, xen_pfn_t is 64 bits but the size of a pointer is only > 32 bits, so casting between them needs to go via (UINTN) > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx> > --- > OvmfPkg/XenBusDxe/GrantTable.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/OvmfPkg/XenBusDxe/GrantTable.c b/OvmfPkg/XenBusDxe/GrantTable.c > index 37d3bf786c64..cc6f045c9827 100644 > --- a/OvmfPkg/XenBusDxe/GrantTable.c > +++ b/OvmfPkg/XenBusDxe/GrantTable.c > @@ -160,7 +160,7 @@ XenGrantTableInit ( > Parameters.domid = DOMID_SELF; > Parameters.idx = Index; > Parameters.space = XENMAPSPACE_grant_table; > - Parameters.gpfn = (((xen_pfn_t) GrantTable) >> EFI_PAGE_SHIFT) + Index; > + Parameters.gpfn = (((xen_pfn_t)(UINTN) GrantTable) >> EFI_PAGE_SHIFT) + > Index; > ReturnCode = XenHypercallMemoryOp (Dev, XENMEM_add_to_physmap, > &Parameters); > if (ReturnCode != 0) { > DEBUG ((EFI_D_ERROR, "Xen GrantTable, add_to_physmap hypercall error: > %d\n", ReturnCode)); > @@ -182,7 +182,7 @@ XenGrantTableDeinit ( > > for (Index = NR_GRANT_FRAMES - 1; Index >= 0; Index--) { > Parameters.domid = DOMID_SELF; > - Parameters.gpfn = (((xen_pfn_t) GrantTable) >> EFI_PAGE_SHIFT) + Index; > + Parameters.gpfn = (((xen_pfn_t)(UINTN) GrantTable) >> EFI_PAGE_SHIFT) + > Index; > DEBUG ((EFI_D_INFO, "Xen GrantTable, removing %X\n", Parameters.gpfn)); > ReturnCode = XenHypercallMemoryOp (Dev, XENMEM_remove_from_physmap, > &Parameters); > if (ReturnCode != 0) { > On a 32-bit platform you shouldn't bit-shift 64-bit integers, because the compiler might generate calls to intrinsic functions, and those are not allowed in edk2. Please use RShiftU64() in addition to the above changes. (Example: "MdePkg/Library/BaseLib/Ia32/RShiftU64.S".) Thanks, Laszlo _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |