Shared memory between kernel driver and multiple processes
- From: "Olivier M" <olivier_martin@xxxxxxxxxxx>
- Date: 14 Nov 2006 10:14:15 -0800
Hi all,
I would like to allocate memory from a kernel driver (not necessarily
at driver load time) and arbitrarily map the memory to client
application processes. The memory must be readable and writable from
all processes that it's mapped to as well being accessible within the
kernel driver.
I have an idea about possible solutions but would like to understand
better what's best practice / possible etc.
- Solution 1: for kernel driver:
AllocPhysMem() gives a CPU relative physical address + Kernel CPU
virtual
VirtualAllocEx/VirtualCopyEx reserves arbitrary space in client process
and maps the physical address range to it.
-> This solution seems workable but relies on physically contiguous
memory - issues beyond boot time.
- Solution 2: for kernel driver:
HeapCreate()/HeapAlloc() create a kernel heap and allocate kernel CPU
virtual addresses from it
Use VirtualAllocCopyEx() to re-map memory to processes.
-> This solution doesn't depend on physically contiguous memory but I
doubt it's valid for VirtualAllocCopyEx to operate on kernel heap
allocations?
- Solution 3: File Mapping:
CreateFileMapping() / MapViewOfFile - kernel driver manages
allocations in a File mapping
User application processes can access kernel allocations in the file
mapping and have read/write access
-> Doesn't rely on physically contiguous memory although is not an
'orthogonal' solution compared to the way this is achieved in other
OSs (e.g. Linux). To give some background, WinCE is one of many OS
supported in a generic Driver Porting Software framework.
Any Feedback or advice is welcome
Thanks,
Olivier
.
- Follow-Ups:
- Re: Shared memory between kernel driver and multiple processes
- From: voidcoder
- Re: Shared memory between kernel driver and multiple processes
- Prev by Date: Re: CMD Cannot Start
- Next by Date: How to get romfilter working on WinCE 6
- Previous by thread: Re: CMD Cannot Start
- Next by thread: Re: Shared memory between kernel driver and multiple processes
- Index(es):
Relevant Pages
|