extended the fix from port_access_multiple() to port_access()
This commit is contained in:
@@ -230,7 +230,9 @@ Use i386_get_ioperm, i386_set_ioperm from <machine/sysarch.h> and inb and outb f
|
||||
#include <machine/cpufunc.h>
|
||||
#include <machine/sysarch.h>
|
||||
|
||||
#if (__FreeBSD_version > 500000)
|
||||
static FILE * port_access_handle = NULL;
|
||||
#endif
|
||||
|
||||
/* Read a byte from port */
|
||||
static inline int port_in (unsigned short port) {
|
||||
@@ -244,7 +246,16 @@ static inline void port_out (unsigned short port, unsigned char val) {
|
||||
|
||||
/* Get access to a specific port */
|
||||
static inline int port_access (unsigned short port) {
|
||||
#if (__FreeBSD_version > 500000)
|
||||
if( port_access_handle
|
||||
|| (port_access_handle = fopen("/dev/io", "rw")) != NULL ) {
|
||||
return i386_set_ioperm(port, 1, 1);
|
||||
} else {
|
||||
return( -1 ); /* Failure */
|
||||
};
|
||||
#else
|
||||
return i386_set_ioperm(port, 1, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Get access to multiple ports at once */
|
||||
|
||||
Reference in New Issue
Block a user