According to the present invention, a "smart system call" may be
implemented. The smart system call employs a code "stub" that is used to
make function calls to privileged memory locations. The code stub
includes facilities to determine the current mode of execution (e.g.,
privileged, unprivileged), and where the current mode is sufficiently
trusted, allows a direct access to the desired memory address. If the
current mode is not sufficiently trusted (e.g., unprivileged), an
alternate indirect system call mechanism may be employed, such as an
interrupt-based, exception-based, or hardware-assisted system call.
Additionally, the smart system call permits selection of a system call
method based on processor type, which may be used, for example, for
porting to processor architectures which support specialized
hardware-assisted system call instructions.