-/* $OpenBSD: uvm_mmap.c,v 1.167 2021/12/23 18:50:32 guenther Exp $ */
+/* $OpenBSD: uvm_mmap.c,v 1.168 2022/01/05 17:53:44 guenther Exp $ */
/* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */
/*
vaddr_t baseva, last_baseva, endva, pageoffset, kva;
size_t psize, s;
u_long pc;
- int count, i;
+ int count, i, extra;
int error;
/*
paramp[count].kb_size > KBIND_DATA_MAX ||
baseva >= VM_MAXUSER_ADDRESS ||
endva >= VM_MAXUSER_ADDRESS ||
- trunc_page(baseva) != trunc_page(endva) ||
s < paramp[count].kb_size)
return EINVAL;
TAILQ_INIT(&dead_entries);
for (i = 0; i < count; i++) {
baseva = (vaddr_t)paramp[i].kb_addr;
+ s = paramp[i].kb_size;
pageoffset = baseva & PAGE_MASK;
baseva = trunc_page(baseva);
+ /* hppa at least runs PLT entries over page edge */
+ extra = (pageoffset + s) & PAGE_MASK;
+ if (extra > pageoffset)
+ extra = 0;
+ else
+ s -= extra;
+redo:
/* make sure sure the desired page is mapped into kernel_map */
if (baseva != last_baseva) {
if (kva != 0) {
}
/* do the update */
- if ((error = kcopy(data, (char *)kva + pageoffset,
- paramp[i].kb_size)))
+ if ((error = kcopy(data, (char *)kva + pageoffset, s)))
break;
- data += paramp[i].kb_size;
+ data += s;
+
+ if (extra > 0) {
+ baseva += PAGE_SIZE;
+ s = extra;
+ pageoffset = 0;
+ extra = 0;
+ goto redo;
+ }
}
if (kva != 0) {