This is an implementation parts of the following functionality:
http://man7.org/linux/man-pages/man2/mbind.2.html
I'm still testing so this is a WIP. I am not overly familiar with the vm_map_entry and anonymous vm_object split/merge rules. I'm looking for comments on whether I'm missing anything big in vm_map_setdomain(). I need to detect holes in the address space still since that should throw an error. I noticed that there was a ton of repeated code in vm_map.c and did a little cleanup to create a function I needed.
The kern_cpuset part is just boilerplate to copy in and validate the domain. I can easily test and verify that so feel free to ignore.