Maker Pro
Maker Pro

Windows mapping

J

John Larkin

Jan 1, 1970
0
Does anybody know if there's a system call or something that allows a
chunk of physical memory (I'm thinking a block of dpm located on a PCI
board) to be mapped into the addressing space of a user program, so
it's directly addressable?

I suppose the alternative would be to have a device driver or a dll
copy blocks of stuff between the PCI bus and the user space, but
that's clumsy.

John
 
T

The Real Andy

Jan 1, 1970
0
Does anybody know if there's a system call or something that allows a
chunk of physical memory (I'm thinking a block of dpm located on a PCI
board) to be mapped into the addressing space of a user program, so
it's directly addressable?

I suppose the alternative would be to have a device driver or a dll
copy blocks of stuff between the PCI bus and the user space, but
that's clumsy.

John

Which OS? The non-clumsy safe way to do it is to use a driver.
 
F

Frithiof Andreas Jensen

Jan 1, 1970
0
John Larkin said:
Does anybody know if there's a system call or something that allows a
chunk of physical memory (I'm thinking a block of dpm located on a PCI
board) to be mapped into the addressing space of a user program, so
it's directly addressable?

"""
NAME
mmap, munmap - map or unmap files or devices into memory
^^^^^
SYNOPSIS
#include <sys/mman.h>

void * mmap(void *start, size_t length, int prot , int flags, int fd,
off_t offset);

int munmap(void *start, size_t length);

DESCRIPTION
The mmap function asks to map length bytes starting at offset
offset from the file (or other
object) specified by the file descriptor fd into memory, preferably at
address start. This latter
address is a hint only, and is usually specified as 0. The actual place
where the object is mapped
is returned by mmap, and is never 0.

"""

Some kind of driver is needed to perform an open() on the device so it can be
mapped in the first place. On Linux one can skip all that and (relatively)
trivially map the device to pseudo-files under /sysfs - from there it's all user
side.
I suppose the alternative would be to have a device driver or a dll
copy blocks of stuff between the PCI bus and the user space, but
that's clumsy.

Who knows what 'doze does; is it supposed to be Posix compliant as NT was?
 
C

colin

Jan 1, 1970
0
John Larkin said:
Does anybody know if there's a system call or something that allows a
chunk of physical memory (I'm thinking a block of dpm located on a PCI
board) to be mapped into the addressing space of a user program, so
it's directly addressable?

I suppose the alternative would be to have a device driver or a dll
copy blocks of stuff between the PCI bus and the user space, but
that's clumsy.

Its eons since I did this and it was on NT3.5,
I think you have to do the memory locking and mapping in a device driver,
but I think you can then share that memory with the user level program.

Colin =^.^=
 
J

Joel Kolstad

Jan 1, 1970
0
Hi John,

John Larkin said:
Does anybody know if there's a system call or something that allows a
chunk of physical memory (I'm thinking a block of dpm located on a PCI
board) to be mapped into the addressing space of a user program, so
it's directly addressable?

Assuming Windows here, the function call you're after is MmMapIoSpace. This
is a kernel function, though, so you'll need a proper device driver to perform
the task for you (or you can use one of those "generic" device drivers that
lets a user mode program poke around anywhere it wants -- I used WinRT for
this pushing a decade ago, and they're long since dead, but I expect there are
current alternatives available).

---Joel
 
Top