On Tue, Jan 30, 2024 at 9:45 PM Samuel Thibault <samuel.thiba...@gnu.org> wrote: > > > +kern_return_t vm_pages_phys( > > > + host_t host, > > > + vm_map_t map, > > > + vm_address_t address, > > > + vm_size_t size, > > > > This is supposed to be a number of pages rather than VM region size, > > right? > > No, I followed the same principle as the vm_allocate etc. calls. > > In the function itself, count = atop(size).
Ack, indeed, I was looking at the wrong thing. > > You're supposed to allocate your own buffer in this case, something like > > this: > > Ok, done so, thanks! I see you used kmem_alloc_pageable() over kmem_alloc() that I suggested. Why is that? My understanding is the point of kmem_alloc() is to be used in cases like this, when you don't want the routine itself to fault while holding locks on VM objects/maps. Sergey