i386_set_ioperm() problems

Sascha Wildner saw at online.de
Mon Feb 27 16:26:00 PST 2006


Hi,

I'm trying to write a little test utility to mess with VGA registers. 
Example:

-------------------------
#include <stdio.h>
#include <stdlib.h>
#include <machine/cpufunc.h>
#include <machine/sysarch.h>
#define SEQIDX	0x03c4
#define SEQREG	0x03c5
int
main(int argc, char *argv[])
{
	int i;
	i386_set_ioperm(SEQIDX, 1, 1);
	i386_set_ioperm(SEQREG, 1, 1);
	for (i = 0; i <= 4; i++) {
		outb(SEQIDX, i);
		printf("%d\n", inb(SEQREG));
	}
	i386_set_ioperm(SEQIDX, 1, 0);
	i386_set_ioperm(SEQREG, 1, 0);
	exit(EXIT_SUCCESS);
}
-------------------------
Problem is that the code dumps core in machine/cpufunc.h. On one of my 
machines, it will actually print the values every 5 or 6 times I run it. 
In all other cases I get the core dump (on my laptop it dumps core 
always and never prints anything).

Sascha





More information about the Kernel mailing list