[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Userspace PIO access under xen



Hi!
The following simple program (below) mmaps PCI I/O memory
into userspace. This works fine under linux, but not in Xen dom0.

Linux:

# ./test1 /sys/bus/pci/devices/0000\:07\:00.0/resource0 0
0 0

Xen dom0:

# ./test1 /sys/bus/pci/devices/0000\:07\:00.0/resource0 0
0 0xf000eef3

Where does one start looking at fixing this?
Thanks,
MST

---

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <string.h>


/* Usage: test0 file offset */


int main(int argc, char** argv)
{
    int fd;
    if (argc < 3) {
            fprintf(stderr, "Usage: %s file offset\n", argv[0]);
            return 2;
    }

    fd = open(argv[1], O_RDWR | O_SYNC);
    if (fd < 0) {
            perror("open");
            return errno;
    }

    long o = strtol(argv[2], NULL, 0);

    long* ptr = mmap(NULL, 0x1000, PROT_READ, MAP_SHARED, fd, o);

    if ( (! ptr) || (ptr == MAP_FAILED) ) {
            perror("mmap");
            return errno;
    }

    printf("%#lx %#lx\n", o, *ptr);

    return 0;
}

-- 
MST

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.