Peter Stuge wrote:
On Wed, Jun 06, 2007 at 11:16:03PM +0700, Darmawan Salihun wrote:
- Kernel driver allowing unrestricted reads and writes to top 16MB.
The current version of the driver code is capable of mapping *anywhere* within the 4GB physical address space. It shouldn't be a problem to restrict it to the top 16MB.
We should make that 2MB until we actually support larger flash parts btw.
ok, no problem.
The logic of the mapping process is as follows: a. The physical memory address range is mapped into the kernel's virtual memory address range b. The kernel's virtual memory address range is then mapped to the "requesting" user mode virtual memory address range.
Sounds good.
For those interested in the driver code attached previously. The bulk of the work is carried out in two functions, i.e.
NTSTATUS MapMmio(PDEVICE_OBJECT pDO, PIRP pIrp) /*++ Routine Description: Process the IRPs with IOCTL_MAP_MMIO code. This routine maps a physical address range to the usermode application address space.
Arguments: pDO - pointer to the device object of this driver. pIrp - pointer to an I/O Request Packet.
Return Value: NT Status code
Notes: This function can only map the area below the 4-GB limit. --*/
and
NTSTATUS CleanupMmioMapping(PDEVICE_EXTENSION pDevExt, ULONG i) /*++ Routine Description: This routine cleanup the mapping of a MMIO range and resources it consumes.
Arguments: pDevExt - pointer to the device extension of the driver i - index of the mapZone to cleanup
Return Value: NT Status code --*/
That's all for now.
--Darmawan Salihun