Hi all, I am fairly new to openbsd so if this is something obvious that I missed please be understanding.
I am adding a syscall to openbsd 6.8. I am working on a raspberry pi. During the syscall I allocate some memory that I want to share between the kernel and the calling process. When it's time to wrap up and unmap the memory, I unmap it both from the kernel map and from the process map. The unmapping from the process map goes fine, the unmapping from the kernel map fails by saying that the virtual address in kernel map is not aligned to the page size ( it's actually 4 bytes off ). What have I missed? I assumed that umm_map would return a page aligned virtual address for the kernel mapping as well. Here is my code for creating the shared memory chunk: -------------------------------------------------------------------------------- // memory_size is a multiple of page size uvm_object = uao_create(memory_size, 0); if(!uvm_object) return; // TODO(ale): make sure that this memory cannot be swapped out uao_reference(uvm_object) if(uvm_map(kernel_map, (vaddr_t *)&memory, round_page(memory_size), uvm_object, 0, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE, MAP_INHERIT_SHARED, MADV_NORMAL, 0))) { uao_detach(uvm_object); uvm_object = 0; return; } uao_reference(uvm_object); if(uvm_map(&p->p_vmspace->vm_map, &memory_in_proc_space, round_page(memory_size), uvm_object, 0, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE, MAP_INHERIT_NONE, MADV_NORMAL, 0))) { memory = 0; uao_detach(uvm_object); uao_detach(uvm_object); uvm_object = 0; return; } -------------------------------------------------------------------------------- Thanks, A