VM implicitly aligns mappings to a page
- problem when a PCI BAR is not aligned - together with David v. Moolenboek
This commit is contained in:
parent
a1eefc013e
commit
de1bcaa69a
1 changed files with 6 additions and 1 deletions
|
@ -133,6 +133,7 @@ PUBLIC int do_map_phys(message *m)
|
||||||
struct vir_region *vr;
|
struct vir_region *vr;
|
||||||
vir_bytes len;
|
vir_bytes len;
|
||||||
phys_bytes startaddr;
|
phys_bytes startaddr;
|
||||||
|
size_t offset;
|
||||||
|
|
||||||
target = m->VMMP_EP;
|
target = m->VMMP_EP;
|
||||||
len = m->VMMP_LEN;
|
len = m->VMMP_LEN;
|
||||||
|
@ -159,6 +160,10 @@ PUBLIC int do_map_phys(message *m)
|
||||||
if(!(vmp->vm_flags & VMF_HASPT))
|
if(!(vmp->vm_flags & VMF_HASPT))
|
||||||
return ENXIO;
|
return ENXIO;
|
||||||
|
|
||||||
|
offset = startaddr % VM_PAGE_SIZE;
|
||||||
|
len += offset;
|
||||||
|
startaddr -= offset;
|
||||||
|
|
||||||
if(len % VM_PAGE_SIZE)
|
if(len % VM_PAGE_SIZE)
|
||||||
len += VM_PAGE_SIZE - (len % VM_PAGE_SIZE);
|
len += VM_PAGE_SIZE - (len % VM_PAGE_SIZE);
|
||||||
|
|
||||||
|
@ -168,7 +173,7 @@ PUBLIC int do_map_phys(message *m)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
m->VMMP_VADDR_REPLY = (void *) arch_map2vir(vmp, vr->vaddr);
|
m->VMMP_VADDR_REPLY = (void *) (arch_map2vir(vmp, vr->vaddr) + offset);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue