FLUSHTLB(K) UNIX System V FLUSHTLB(K)
Name
flushtlb - flushes the translation lookaside buffer
Syntax
void
flushtlb()
Description
When accessing an I/O port above 0x1000, a driver must flush
the translate lookaside buffer (TLB) to prevent corruption
of the I/O address. In addition, the call to flushtlb must
be protected by a call to spl7 to prevent interrupts from
occurring while flushtlb is operating.
Example
The following example is for a driver routine that gets a
byte from an I/O port and checks the address before
beginning processing. A driver should also have a similar
routine for writing data to an I/O port.
int
getbyte(port)
{
int x, ret;
/*
* If port address is less than hex 1000,
* get byte and return.
*/
if (port < 0x1000)
return( inb(port) );
/* else, */
x = spl7(); /* block all interrupts */
flushtlb(); /* flush TLB */
ret = inb(port); /* get byte from port */
splx(x); /* reset previous spl */
return(ret); /* return byte to caller */
}
See Also
inb(K), spl(K)
(printed 7/19/89)