Re: copy from contiguous kernel memory - better way?



Tim Roberts wrote:
Rich <Rich@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

I started the driver skeleton from the avshws sample, but it's so
far a custom interface.

The capture h/w requires a contiguous destination buffer, but as the
majority of my driver experience is in embedded systems with linear
memory models (vxworks), I'm not sure if a mapped/probe and locked
user buffer counts as a "contiguous" buffer from the h/w's
perspective.

No, it doesn't. They will be contiguous in virtual space, but not in
physical space. If the hardware requires contiguous physical space,
then you must use a common buffer, and that means you must copy.

It should be possible to have zero-copy by mapping the buffer into usermode
directly though. Probably need to create a kernel mapping object and have
the usermode call VirtualAlloc(MEM_RESERVE) and MapViewOfFile. Just make
sure you don't trust the content of memory that can be written from
userspace.


.



Relevant Pages

  • Re: copy from contiguous kernel memory - better way?
    ... I started the driver skeleton from the avshws sample, ... The capture h/w requires a contiguous destination buffer, ... If the hardware requires contiguous physical space, ...
    (microsoft.public.development.device.drivers)
  • [PATCH UPDATED] xen: add xenfs to allow usermode <-> Xen interaction
    ... The xenfs filesystem exports various interfaces to usermode. ... Added a mutex to protect struct xenbus_file_priv. ... and the partial message buffer. ...
    (Linux-Kernel)
  • Re: NDIS IM driver usermode app communication
    ... >> then have the usermode app read from it, but that approach would be ugly. ... > the driver fill the buffer with multiple packets. ...
    (microsoft.public.development.device.drivers)
  • Re: NDIS IM driver usermode app communication
    ... then have the usermode app read from it, but that approach would be ugly. ... If you are monitoring packets, pass a large buffer to the driver and have the driver fill the buffer with multiple packets. ...
    (microsoft.public.development.device.drivers)