Add support to run intel_reg_dumper on OpenBSD.

This commit is contained in:
matthieu 2009-01-29 17:17:24 +00:00
parent 1faf8dcd02
commit af2481e434
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,5 @@
To use the reg dumper program on a running X server you need :
- to build a kernel with 'options INSECURE' and reboot in it
- to set 'securelevel=-1' in /etc/rc.securelevel
- to run intel_reg_dumper as root.

View File

@ -34,6 +34,13 @@
#include "reg_dumper.h"
#ifdef __OpenBSD__
#define DEV_APERTURE "/dev/mem"
int devMemFd = -1;
#include <errno.h>
#include <fcntl.h>
#endif
int main(int argc, char **argv)
{
struct pci_device *dev;
@ -48,6 +55,15 @@ int main(int argc, char **argv)
exit(1);
}
#ifdef __OpenBSD__
devMemFd = open(DEV_APERTURE, O_RDWR);
if (devMemFd < 0) {
fprintf(stderr, "Could not open aperture driver: %s\n", strerror(errno));
exit(1);
}
pci_system_init_dev_mem(devMemFd);
#endif
/* Grab the graphics card */
dev = pci_device_find_by_slot(0, 0, 2, 0);
if (dev == NULL)