Index: sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c =================================================================== --- sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c (revision 289553) +++ sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c (working copy) @@ -528,6 +528,22 @@ return err; } +static int +copyout_page(vm_page_t p, size_t offset, void *kaddr, size_t size) +{ + uint8_t *dst; + + dst = pmap_mapdev(VM_PAGE_TO_PHYS(p), PAGE_SIZE); + if (!dst) + return ENOMEM; + + memcpy(dst + offset, kaddr, size); + + pmap_unmapdev((vm_offset_t)dst, PAGE_SIZE); + + return 0; +} + static void free_pagelist(BULKINFO_T *bi, int actual) { @@ -560,7 +576,8 @@ if (head_bytes > actual) head_bytes = actual; - memcpy((char *)bi->buf, + copyout_page(pages[0], + pagelist->offset, fragments->headbuf, head_bytes); } @@ -567,8 +584,11 @@ if ((actual >= 0) && (head_bytes < actual) && (tail_bytes != 0)) { - memcpy((char *)bi->buf + actual - tail_bytes, - fragments->tailbuf, tail_bytes); + + copyout_page(pages[num_pages-1], + (((vm_offset_t)bi->buf + actual) % PAGE_SIZE) - tail_bytes, + fragments->tailbuf, + tail_bytes); } down(&g_free_fragments_mutex);