[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 23/45] xen: arm: use vaddr_t more widely.
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> --- xen/arch/arm/guestcopy.c | 16 +++++++++------- xen/include/asm-arm/mm.h | 6 +++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/xen/arch/arm/guestcopy.c b/xen/arch/arm/guestcopy.c index 5504e19..de1a216 100644 --- a/xen/arch/arm/guestcopy.c +++ b/xen/arch/arm/guestcopy.c @@ -8,7 +8,7 @@ unsigned long raw_copy_to_guest(void *to, const void *from, unsigned len) { /* XXX needs to handle faults */ - unsigned offset = ((unsigned long)to & ~PAGE_MASK); + unsigned offset = (vaddr_t)to & ~PAGE_MASK; while ( len ) { @@ -17,7 +17,7 @@ unsigned long raw_copy_to_guest(void *to, const void *from, unsigned len) void *p; unsigned size = min(len, (unsigned)PAGE_SIZE - offset); - rc = gvirt_to_maddr((uint32_t) to, &g); + rc = gvirt_to_maddr((vaddr_t) to, &g); if ( rc ) return rc; @@ -38,7 +38,7 @@ unsigned long raw_copy_to_guest(void *to, const void *from, unsigned len) unsigned long raw_clear_guest(void *to, unsigned len) { /* XXX needs to handle faults */ - unsigned offset = ((unsigned long)to & ~PAGE_MASK); + unsigned offset = (vaddr_t)to & ~PAGE_MASK; while ( len ) { @@ -47,7 +47,7 @@ unsigned long raw_clear_guest(void *to, unsigned len) void *p; unsigned size = min(len, (unsigned)PAGE_SIZE - offset); - rc = gvirt_to_maddr((uint32_t) to, &g); + rc = gvirt_to_maddr((vaddr_t) to, &g); if ( rc ) return rc; @@ -66,19 +66,21 @@ unsigned long raw_clear_guest(void *to, unsigned len) unsigned long raw_copy_from_guest(void *to, const void __user *from, unsigned len) { + unsigned offset = (vaddr_t)from & ~PAGE_MASK; + while ( len ) { int rc; paddr_t g; void *p; - unsigned size = min(len, (unsigned)(PAGE_SIZE - ((unsigned)from & (~PAGE_MASK)))); + unsigned size = min(len, (unsigned)(PAGE_SIZE - offset)); - rc = gvirt_to_maddr((uint32_t) from & PAGE_MASK, &g); + rc = gvirt_to_maddr((vaddr_t) from & PAGE_MASK, &g); if ( rc ) return rc; p = map_domain_page(g>>PAGE_SHIFT); - p += ((unsigned long)from & (~PAGE_MASK)); + p += ((vaddr_t)from & (~PAGE_MASK)); memcpy(to, p, size); diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index 4175e4d..003a6d13 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -180,8 +180,8 @@ extern void clear_fixmap(unsigned map); static inline paddr_t virt_to_maddr(const void *va) { - uint64_t par = va_to_par((uint32_t)va); - return (par & PADDR_MASK & PAGE_MASK) | ((unsigned long) va & ~PAGE_MASK); + uint64_t par = va_to_par((vaddr_t)va); + return (par & PADDR_MASK & PAGE_MASK) | ((vaddr_t) va & ~PAGE_MASK); } static inline void *maddr_to_virt(paddr_t ma) @@ -191,7 +191,7 @@ static inline void *maddr_to_virt(paddr_t ma) return (void *)(unsigned long) ma + XENHEAP_VIRT_START; } -static inline int gvirt_to_maddr(uint32_t va, paddr_t *pa) +static inline int gvirt_to_maddr(vaddr_t va, paddr_t *pa) { uint64_t par = gva_to_ma_par(va); if ( par & PAR_F ) -- 1.7.2.5 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |