A method and apparatus for selectively executing an I/O instruction. The
method includes creating an I/O permission bitmap in a memory and
receiving an I/O port number and a security context identification (SCID)
value. The method also includes using the SCID value and the I/O port
number to access the I/O permission bitmap stored to obtain a permission
bit corresponding to the I/O port and executing the I/O instruction
dependent upon a value of the permission bit corresponding to the I/O
port. The I/O permission bitmap includes a plurality of permission bits.
Each of the permission bits corresponds to a different one of a plurality
of I/O ports. Each of the permission bits has a value indicating whether
access to the corresponding I/O port is allowed. The I/O port number
indicates the I/O port referenced by the I/O instruction. The SCID value
indicates a security context level of a memory location including the I/O
instruction.