Fwd: Creating a "new" virtual address space for a process

Joe Damato jdamato at andrew.cmu.edu
Mon Jan 22 16:11:01 UTC 2007


Pranav Sawargaonkar wrote:
>> >We have a process, (in this case it happens to be curproc or proc0), 
>> and
>> >we would like to create a new virtual address space and allocate, say N
>> >pages starting at address X.
>   To allocate new vmspace and vm_map you can use vmspace_fork() 
> defined in
> vm/vm_map.c.

vmspace_fork() is something we looked at already... It "creates a new 
vmspace structure and vm_map based on those of an existing process..." 
My understanding is that the problem with using vmspace_fork is that we 
don't know which virtual addresses are backed with physical pages and as 
such, we don't know what virtual address to begin copying data to (we 
were planning on using copyout). This process will never execute - we 
just need to copy a lot of kernel data to user memory, so we don't 
really care if we overwrite user stack or heap or anything like that. We 
simply want to choose (or be given) a starting virtual address where we 
can copy N pages.

Thanks for your suggestion, any other hints or suggestions are 
definitely welcome.

Thanks,
Joe


More information about the freebsd-hackers mailing list