Re: How to use make a UMA frame buffer mapping from kernel to user
- From: driver_folks <driverfolks@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 12 Dec 2007 07:12:01 -0800
How can I make sure it's in the right context of that user-mode process? I
need map it in the IOCTL_VIDEO_SHARE_VIDEO_MEMORY. And the current process
handle is always -1(0xFFFFFFFF).
Thanks
"Sasha Bublyk" wrote:
About MmMapLockedPagesSpecifyCache. Actually, everything is right. You can.
allocate buffer in kernel space and map it to user space. But you *must* be
in the context of that user-mode process. So the sequence will be right:
ExAllocatePool
IoAllocateMdl
MmProbeAndLockPages with parameter KernelMode
MmMapLockedPagesSpecifyCache with parameter UserMode
---
Sasha Bublyk
www.sycorelogic.com
"driver_folks" <driverfolks@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D89519C8-25FF-449B-A6B1-DD5DB8748CBF@xxxxxxxxxxxxxxxx
Thanks for comments, Tim.
1. Why we use reserved virtual space (created by MmAllocateMappingAddress
and MmMapLockedPagesWithReservedMapping) is that we can dynamicly allocate
different size of virtual memory and map it to physcial when necessary.
ExAllocatePool has to pre-allocate a large size of memory and it possesses
memory resources which won't be used.
2. I tried the MmMapLockedPagesSpecifyCache, but failed. Maybe what I did
is
wrong. Here is my steps:
a. call IoAllocateMdl;
b. call MmProbeAndLockPages;
c. call MmMapLockedPagesSpecifyCache; (the access mode is UserMode, isn't
it?).
Thanks
"Tim Roberts" wrote:
driver_folks <driverfolks@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I'm trying to implement a method to map a reserved virtual space
(created by
MmAllocateMappingAddress and MmMapLockedPagesWithReservedMapping) from
kernel
to user mode process.
This is generally considered to be a bad idea. A better idea is to
allocate the buffer in user-mode, and lock it in the kernel driver.
Why use those APIs instead of, for example, just ExAllocatePool?
From the DDK description for VideoPortMapMemory, it
seems we can do UMA (universal memory architecture) frame buffer mapping
as
suggested in the comments.
Well, sort of. Frame buffers are graphics concepts, but the same idea
applies.
The steps are:
1. Call InitializeObjectAttributes to get object attributes;
2. Call ZwOpenSection to get the handle of the section object;
3. Call ZwMapViewOfSection to get the virtual address of the view;
My question is how to set up the relation between the reserved virtual
space
and the section view, that's to say, how to find a section object to
represent the reserved virtual space? Any expert can help to give a
hint?
A much easier method is MmMapLockedPagesSpecifyCache. Make sure that you
are running in the context of the desired process first.
--
Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.
- References:
- Re: How to use make a UMA frame buffer mapping from kernel to user mod
- From: Tim Roberts
- Re: How to use make a UMA frame buffer mapping from kernel to user
- From: driver_folks
- Re: How to use make a UMA frame buffer mapping from kernel to user
- From: Sasha Bublyk
- Re: How to use make a UMA frame buffer mapping from kernel to user mod
- Prev by Date: Re: Retrieving the Buffer for EvtIoDeviceControl in a KMDF Driver
- Next by Date: Installing printer driver and port monitor on vista
- Previous by thread: Re: How to use make a UMA frame buffer mapping from kernel to user
- Next by thread: CoInstaller for class upper filter driver
- Index(es):
Relevant Pages
|