Re: about CeSafeCopyMemory in CE 6
- From: "Dean Ramsier" <ramsiernospam@xxxxxxxxxx>
- Date: Mon, 10 Sep 2007 09:20:31 -0400
I believe (without checking) that this just wraps the copy with a try/except
handler. It does not do memory marshalling.
If the call is being done synchronously, the kernel already can access the
address in user memory (assuming it is a validly mapped address). In this
particular scenario the marshalling APIs just give you the ability to verify
the pointer, and give you the option to copy it to your own buffer if you
like.
If you'll be accessing the pointer asynchronously (on another thread) then
you have to marshall in order to get your own copy of the pointer that will
still be valid after a process switch.
The kernel operates in the upper 2G of address space. The user process is
in the lower 2G. When a kernel thread is running, the user space in the
lower 2G is still valid so a user mode pointer coming from that space is
still accessible. This works because the kernel mode thread is allowed to
access the user mode space. The reverse is not true, the user mode thread
can't access the kernel mode space even though it is mapped in.
--
Dean Ramsier - eMVP
BSQUARE Corporation
<ctbpl.xiayi@xxxxxxxxx> wrote in message
news:1189405411.889811.104780@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi All,
Will CeSafeCopyMemory do the memory marshalling when I call it in my
kernel mode driver to access memory pointed by a embedded user space
pointer?
What's the biggest downside if I directly access the memory pointed by
an user space pointer except the security problem? Will the kernel
help to do the memory mapping(page table setup to access the same
physical memory) or copy it into kernel space memory when a user
space' pointer parameter is passed into kernel space?
When process switch to kernel mode , is the page table of user space's
current application will be copied into the kernel mode process's page
table?
I searched CeSafeCopyMemory in google, and found very few matches. Can
anyone give me some instructions?
Max.
.
- Follow-Ups:
- Re: about CeSafeCopyMemory in CE 6
- From: Ross Jordan [MSFT]
- Re: about CeSafeCopyMemory in CE 6
- References:
- about CeSafeCopyMemory in CE 6
- From: ctbpl . xiayi
- about CeSafeCopyMemory in CE 6
- Prev by Date: Re: ROMimage tool
- Next by Date: Re: Help, help, help, more help, extra help, HELP! how to turn off IDE DMA...
- Previous by thread: about CeSafeCopyMemory in CE 6
- Next by thread: Re: about CeSafeCopyMemory in CE 6
- Index(es):
Relevant Pages
|