diff options
author | decke <decke@FreeBSD.org> | 2013-09-21 18:41:53 +0000 |
---|---|---|
committer | decke <decke@FreeBSD.org> | 2013-09-21 18:41:53 +0000 |
commit | 33409f27d97838cc9a0860fca4375a912b02a3f0 (patch) | |
tree | 55e811402b72a6837b8eeb1d3ea2ebc83822788b | |
parent | b4ac8610b749ec9d152c8d51303422dff4c256ec (diff) | |
download | FreeBSD-ports-33409f27d97838cc9a0860fca4375a912b02a3f0.zip FreeBSD-ports-33409f27d97838cc9a0860fca4375a912b02a3f0.tar.gz |
- Fix calls of vm_map_find() after r255426 broke it and added
a mmap flag.
PR: ports/181971,
ports/182121
Submitted by: Lawrence Stewart <lstewart@FreeBSD.org>,
Dan McGregor <dan.mcgregor@usask.ca>
6 files changed, 192 insertions, 0 deletions
diff --git a/emulators/virtualbox-ose-additions/files/patch-src-VBox-Runtime-r0drv-freebsd-alloc-r0drv-freebsd.c b/emulators/virtualbox-ose-additions/files/patch-src-VBox-Runtime-r0drv-freebsd-alloc-r0drv-freebsd.c new file mode 100644 index 0000000..f8b9743 --- /dev/null +++ b/emulators/virtualbox-ose-additions/files/patch-src-VBox-Runtime-r0drv-freebsd-alloc-r0drv-freebsd.c @@ -0,0 +1,16 @@ +--- src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c 2013-09-06 06:30:30.000000000 -0600 ++++ src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c 2013-09-18 12:01:45.000000000 -0600 +@@ -79,8 +79,13 @@ + return VERR_NO_EXEC_MEMORY; + + /* Addr contains a start address vm_map_find will start searching for suitable space at. */ ++#if __FreeBSD_version >= 1000055 ++ int rc = vm_map_find(kernel_map, pVmObject, 0, &Addr, ++ cbAllocated, 0, VMFS_ANY_SPACE, VM_PROT_ALL, VM_PROT_ALL, 0); ++#else + int rc = vm_map_find(kernel_map, pVmObject, 0, &Addr, + cbAllocated, TRUE, VM_PROT_ALL, VM_PROT_ALL, 0); ++#endif + if (rc == KERN_SUCCESS) + { + rc = vm_map_wire(kernel_map, Addr, Addr + cbAllocated, diff --git a/emulators/virtualbox-ose-additions/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd_VM_MAP_FIND.c b/emulators/virtualbox-ose-additions/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd_VM_MAP_FIND.c new file mode 100644 index 0000000..6dfe0b9 --- /dev/null +++ b/emulators/virtualbox-ose-additions/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd_VM_MAP_FIND.c @@ -0,0 +1,48 @@ +--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2013-09-06 12:30:30.000000000 +0000 ++++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2013-09-21 18:12:53.000000000 +0000 +@@ -286,9 +286,15 @@ + pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, cPages); + + /* No additional object reference for auto-deallocation upon unmapping. */ ++#if __FreeBSD_version >= 1000055 ++ rc = vm_map_find(kernel_map, pMemFreeBSD->pObject, 0, ++ &MapAddress, pMemFreeBSD->Core.cb, 0, VMFS_ANY_SPACE, ++ fExecutable ? VM_PROT_ALL : VM_PROT_RW, VM_PROT_ALL, 0); ++#else + rc = vm_map_find(kernel_map, pMemFreeBSD->pObject, 0, + &MapAddress, pMemFreeBSD->Core.cb, VMFS_ANY_SPACE, + fExecutable ? VM_PROT_ALL : VM_PROT_RW, VM_PROT_ALL, 0); ++#endif + + if (rc == KERN_SUCCESS) + { +@@ -551,6 +557,9 @@ + 0, /* offset */ + &MapAddress, /* addr (IN/OUT) */ + cb, /* length */ ++#if __FreeBSD_version >= 1000055 ++ 0, /* max addr */ ++#endif + pvFixed == (void *)-1 ? VMFS_ANY_SPACE : VMFS_NO_SPACE, + /* find_space */ + VM_PROT_NONE, /* protection */ +@@ -628,6 +637,9 @@ + offSub, /* Start offset in the object */ + &Addr, /* Start address IN/OUT */ + cbSub, /* Size of the mapping */ ++#if __FreeBSD_version >= 1000055 ++ 0, /* Upper bound of mapping */ ++#endif + VMFS_ANY_SPACE, /* Whether a suitable address should be searched for first */ + ProtectionFlags, /* protection flags */ + VM_PROT_ALL, /* Maximum protection flags */ +@@ -704,6 +716,9 @@ + 0, /* Start offset in the object */ + &AddrR3, /* Start address IN/OUT */ + pMemToMap->cb, /* Size of the mapping */ ++#if __FreeBSD_version >= 1000055 ++ 0, /* Upper bound of the mapping */ ++#endif + R3PtrFixed == (RTR3PTR)-1 ? VMFS_ANY_SPACE : VMFS_NO_SPACE, + /* Whether a suitable address should be searched for first */ + ProtectionFlags, /* protection flags */ diff --git a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-alloc-r0drv-freebsd.c b/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-alloc-r0drv-freebsd.c new file mode 100644 index 0000000..f8b9743 --- /dev/null +++ b/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-alloc-r0drv-freebsd.c @@ -0,0 +1,16 @@ +--- src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c 2013-09-06 06:30:30.000000000 -0600 ++++ src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c 2013-09-18 12:01:45.000000000 -0600 +@@ -79,8 +79,13 @@ + return VERR_NO_EXEC_MEMORY; + + /* Addr contains a start address vm_map_find will start searching for suitable space at. */ ++#if __FreeBSD_version >= 1000055 ++ int rc = vm_map_find(kernel_map, pVmObject, 0, &Addr, ++ cbAllocated, 0, VMFS_ANY_SPACE, VM_PROT_ALL, VM_PROT_ALL, 0); ++#else + int rc = vm_map_find(kernel_map, pVmObject, 0, &Addr, + cbAllocated, TRUE, VM_PROT_ALL, VM_PROT_ALL, 0); ++#endif + if (rc == KERN_SUCCESS) + { + rc = vm_map_wire(kernel_map, Addr, Addr + cbAllocated, diff --git a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd_VM_MAP_FIND.c b/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd_VM_MAP_FIND.c new file mode 100644 index 0000000..6dfe0b9 --- /dev/null +++ b/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd_VM_MAP_FIND.c @@ -0,0 +1,48 @@ +--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2013-09-06 12:30:30.000000000 +0000 ++++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2013-09-21 18:12:53.000000000 +0000 +@@ -286,9 +286,15 @@ + pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, cPages); + + /* No additional object reference for auto-deallocation upon unmapping. */ ++#if __FreeBSD_version >= 1000055 ++ rc = vm_map_find(kernel_map, pMemFreeBSD->pObject, 0, ++ &MapAddress, pMemFreeBSD->Core.cb, 0, VMFS_ANY_SPACE, ++ fExecutable ? VM_PROT_ALL : VM_PROT_RW, VM_PROT_ALL, 0); ++#else + rc = vm_map_find(kernel_map, pMemFreeBSD->pObject, 0, + &MapAddress, pMemFreeBSD->Core.cb, VMFS_ANY_SPACE, + fExecutable ? VM_PROT_ALL : VM_PROT_RW, VM_PROT_ALL, 0); ++#endif + + if (rc == KERN_SUCCESS) + { +@@ -551,6 +557,9 @@ + 0, /* offset */ + &MapAddress, /* addr (IN/OUT) */ + cb, /* length */ ++#if __FreeBSD_version >= 1000055 ++ 0, /* max addr */ ++#endif + pvFixed == (void *)-1 ? VMFS_ANY_SPACE : VMFS_NO_SPACE, + /* find_space */ + VM_PROT_NONE, /* protection */ +@@ -628,6 +637,9 @@ + offSub, /* Start offset in the object */ + &Addr, /* Start address IN/OUT */ + cbSub, /* Size of the mapping */ ++#if __FreeBSD_version >= 1000055 ++ 0, /* Upper bound of mapping */ ++#endif + VMFS_ANY_SPACE, /* Whether a suitable address should be searched for first */ + ProtectionFlags, /* protection flags */ + VM_PROT_ALL, /* Maximum protection flags */ +@@ -704,6 +716,9 @@ + 0, /* Start offset in the object */ + &AddrR3, /* Start address IN/OUT */ + pMemToMap->cb, /* Size of the mapping */ ++#if __FreeBSD_version >= 1000055 ++ 0, /* Upper bound of the mapping */ ++#endif + R3PtrFixed == (RTR3PTR)-1 ? VMFS_ANY_SPACE : VMFS_NO_SPACE, + /* Whether a suitable address should be searched for first */ + ProtectionFlags, /* protection flags */ diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-alloc-r0drv-freebsd.c b/emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-alloc-r0drv-freebsd.c new file mode 100644 index 0000000..f8b9743 --- /dev/null +++ b/emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-alloc-r0drv-freebsd.c @@ -0,0 +1,16 @@ +--- src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c 2013-09-06 06:30:30.000000000 -0600 ++++ src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c 2013-09-18 12:01:45.000000000 -0600 +@@ -79,8 +79,13 @@ + return VERR_NO_EXEC_MEMORY; + + /* Addr contains a start address vm_map_find will start searching for suitable space at. */ ++#if __FreeBSD_version >= 1000055 ++ int rc = vm_map_find(kernel_map, pVmObject, 0, &Addr, ++ cbAllocated, 0, VMFS_ANY_SPACE, VM_PROT_ALL, VM_PROT_ALL, 0); ++#else + int rc = vm_map_find(kernel_map, pVmObject, 0, &Addr, + cbAllocated, TRUE, VM_PROT_ALL, VM_PROT_ALL, 0); ++#endif + if (rc == KERN_SUCCESS) + { + rc = vm_map_wire(kernel_map, Addr, Addr + cbAllocated, diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd_VM_MAP_FIND.c b/emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd_VM_MAP_FIND.c new file mode 100644 index 0000000..6dfe0b9 --- /dev/null +++ b/emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd_VM_MAP_FIND.c @@ -0,0 +1,48 @@ +--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2013-09-06 12:30:30.000000000 +0000 ++++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2013-09-21 18:12:53.000000000 +0000 +@@ -286,9 +286,15 @@ + pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, cPages); + + /* No additional object reference for auto-deallocation upon unmapping. */ ++#if __FreeBSD_version >= 1000055 ++ rc = vm_map_find(kernel_map, pMemFreeBSD->pObject, 0, ++ &MapAddress, pMemFreeBSD->Core.cb, 0, VMFS_ANY_SPACE, ++ fExecutable ? VM_PROT_ALL : VM_PROT_RW, VM_PROT_ALL, 0); ++#else + rc = vm_map_find(kernel_map, pMemFreeBSD->pObject, 0, + &MapAddress, pMemFreeBSD->Core.cb, VMFS_ANY_SPACE, + fExecutable ? VM_PROT_ALL : VM_PROT_RW, VM_PROT_ALL, 0); ++#endif + + if (rc == KERN_SUCCESS) + { +@@ -551,6 +557,9 @@ + 0, /* offset */ + &MapAddress, /* addr (IN/OUT) */ + cb, /* length */ ++#if __FreeBSD_version >= 1000055 ++ 0, /* max addr */ ++#endif + pvFixed == (void *)-1 ? VMFS_ANY_SPACE : VMFS_NO_SPACE, + /* find_space */ + VM_PROT_NONE, /* protection */ +@@ -628,6 +637,9 @@ + offSub, /* Start offset in the object */ + &Addr, /* Start address IN/OUT */ + cbSub, /* Size of the mapping */ ++#if __FreeBSD_version >= 1000055 ++ 0, /* Upper bound of mapping */ ++#endif + VMFS_ANY_SPACE, /* Whether a suitable address should be searched for first */ + ProtectionFlags, /* protection flags */ + VM_PROT_ALL, /* Maximum protection flags */ +@@ -704,6 +716,9 @@ + 0, /* Start offset in the object */ + &AddrR3, /* Start address IN/OUT */ + pMemToMap->cb, /* Size of the mapping */ ++#if __FreeBSD_version >= 1000055 ++ 0, /* Upper bound of the mapping */ ++#endif + R3PtrFixed == (RTR3PTR)-1 ? VMFS_ANY_SPACE : VMFS_NO_SPACE, + /* Whether a suitable address should be searched for first */ + ProtectionFlags, /* protection flags */ |