HalAllocateCommonBuffer & MmMapIoSpace problem



Hello to you,

I need help with a problem in ce 5.0 + pxa270

I wrote a driver which uses dma, so it calls HalAllocateCommonBuffer
to get a suitable address.

An application that opens the driver calls a DeviceIoControl to get
the physical address of the buffer and then MmMapIoSpace to read the
data.

When the application calls MmUnmapIoSpace, I get the message:
..... NK Kernel: DEBUGCHK failed in file d:\macallan\private\winceos
\coreos\nk\kernel\physmem.c at line 907

VirtualAlloc / VirtualCopy shows the same error

If I add MmMapIoSpace in the driver, the problem moves to the time
when the application closes the driver and it calls MmUnmapIoSpace,
that is, the first invocation of MmUnmapIoSpace (made by the
application) succeeds but the second fails (the driver calls
MmUnmapIoSpace before calling HalFreeCommonBuffer, to reverse the
ordering the calls).


Can you give me an advice about this?
Thank you very much
.



Relevant Pages

  • MmMapIoSpace problem
    ... I'm developing an internal usage debug tool which needs a driver to ... First I map (using MmMapIoSpace) the contents of CR3 register to get to ... address 0xC0300000 in PAE mode also? ...
    (microsoft.public.development.device.drivers)
  • Re: Is Wince 6.0 really secure?
    ... the kernel drivers which are included in runtime. ... But user can access physical memory as follows1. ... Write a kernel driver which is capabke of using VirtualAlloc, ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Writing and reading from a physical address
    ... MmMapIoSpace(), however, calls into your driver, which does the actual ... driver to read or write some registers on the hardware. ... run my complete application in kernel mode. ...
    (microsoft.public.windowsce.app.development)
  • Re: shared memory between stream driver and application
    ... really like the MMMapIoSpace() in the application code. ... > the message into the driver. ... and set the global abort flag ... You can have the driver create the named event then have the ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Writing and reading from a physical address
    ... How can I map the memory in the driver to my application. ... MmMapIoSpace(), however, calls into your driver, which does the actual ... run my complete application in kernel mode. ...
    (microsoft.public.windowsce.app.development)