24.16.1.15 IO Space Hooks

The user can hook in the IO subsystem by installing functions that will be invoked when certain operations on IO spaces are being performed.

The functions in ios_open_hook are invoked once a new IO space has been opened.

The functions in ios_close_pre_hook are invoked when an IO space is about to be closed. Note that a close_pre hook can prevent the closing operation to be performed by raising an exception.

The functions in ios_close_hook are invoked when an IO space has been closed.

The functions in ios_set_hook are invoked when an IO space becomes the current IO space.

All the hooks above get the id of an IO space as arguments:

type IOS_Hook_Fn = (int<32>)void

The different io* built-ins can be then used by the handlers in order to fetch additional properties of the IO space. For example:

fun my_open_handler = (int<32> ios) void:
{
  printf ("*** The IO space '%s' (%i32d) has been opened.\n",
          iohandler (ios), ios);
}
type IOS_Hook_Close_Fn = (int<32>)void;