access pci from user space

Dominik Meyer mr42 at spamt.net
Sun Feb 27 11:41:49 MST 2005


Hello,

i'm currently trying to do something like pciproxy
(http://scaramanga.co.uk/stuff/qemu-pciproxy/) for mol to let the
Airport driver from OsX access the real hardware.

Now i've come to the point where i have to access the pci device.
I thought it should be possible, to do that from user space and i wrote
a little application to test this, but it didn't work:

base = 0xa0006000; // the address from /proc/bus/pci/devices like
                   // described on
                   // http://www.linuxjournal.com/article/5442
length = 0x2000;

fd = open("/dev/mem", O_RDWR|O_SYNC);

map = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, base);
if (map == MAP_FAILED) {
        printf("map failed\n");
        exit(1);
}
 
memcpy(&buf, map, 0x10);

and then it crashes with a "Bus Error". I have no idea why?
Anybody can help me out?

Dominik

(Full source: http://mitglied.lycos.de/phpspacer/blog/pcitest.c)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.terrasoftsolutions.com/pipermail/mol-general/attachments/20050227/2e738fd9/attachment.bin


More information about the mol-general mailing list