bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mach projected buffers for user-space device drivers? (was: Build improv


From: Thomas Schwinge
Subject: Mach projected buffers for user-space device drivers? (was: Build improvements and warning fixes)
Date: Tue, 06 Sep 2011 13:33:29 +0200
User-agent: Notmuch/0.7-57-g64222ef (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu)

Hi!

> > [projected buffers]

On Sat, 27 Aug 2011 19:14:06 +0200, Samuel Thibault <samuel.thibault@gnu.org> 
wrote:
> Ah, right (hard to answer sanely while following the GHM). Well, anyway,
> grepping through the whole hurd+gnumach+glibc code didn't show any use
> of this.

In fact, this projected buffer interface is not even exported from GNU
Mach.  I quickly created an (untested) patch to completely remove the
code.

But: perhaps this functionality can be userful for user-space device
drivers?  For DMA, for example?

vm/vm_kern.c:

    /*
     *     projected_buffer_allocate
     *
     *     Allocate a wired-down buffer shared between kernel and user task.  
     *      Fresh, zero-filled memory is allocated.
     *      If persistence is false, this buffer can only be deallocated from
     *      user task using projected_buffer_deallocate, and deallocation 
     *      from user task also deallocates the buffer from the kernel map.
     *      projected_buffer_collect is called from vm_map_deallocate to
     *      automatically deallocate projected buffers on task_deallocate.
     *      Sharing with more than one user task is achieved by using 
     *      projected_buffer_map for the second and subsequent tasks.
     *      The user is precluded from manipulating the VM entry of this buffer
     *      (i.e. changing protection, inheritance or machine attributes).
     */
    
    kern_return_t
    projected_buffer_allocate(map, size, persistence, kernel_p, 
                              user_p, protection, inheritance)
           vm_map_t map;
           vm_size_t size;
            int persistence;
           vm_offset_t *kernel_p;
           vm_offset_t *user_p;
            vm_prot_t protection;
            vm_inherit_t inheritance;  /*Currently only VM_INHERIT_NONE 
supported*/
    [...]

    /*
     *     projected_buffer_map
     *
     *     Map an area of kernel memory onto a task's address space.
     *      No new memory is allocated; the area must previously exist in the
     *      kernel memory map.
     */
    
    kern_return_t
    projected_buffer_map(map, kernel_addr, size, user_p, protection, 
inheritance)
           vm_map_t map;
           vm_offset_t kernel_addr;
           vm_size_t size;
           vm_offset_t *user_p;
            vm_prot_t protection;
            vm_inherit_t inheritance;  /*Currently only VM_INHERIT_NONE 
supported*/
    [...]

    /*
     *     projected_buffer_deallocate
     *
     *     Unmap projected buffer from task's address space.
     *      May also unmap buffer from kernel map, if buffer is not
     *      persistent and only the kernel reference remains.
     */
    
    kern_return_t
    projected_buffer_deallocate(map, start, end)
         vm_map_t map;
         vm_offset_t start, end;


Grüße,
 Thomas

Attachment: pgpnQh1iKe21x.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]