Patent ID: 7996659

Claim:
A computer-implemented method comprising: receiving a call to a system routine made from any of a plurality of operation modes configured to execute within a given instruction set architecture, the plurality of operation modes including an unprivileged application mode and a privileged supervisor mode, the unprivileged application mode initiating the call from an application program configured to execute in the given instruction set architecture and the privileged supervisor mode initiating the call from an operating system configured to execute in the given instruction set architecture, the method further comprising the following steps in the following order: determining an execution context of the operation mode from which the call was made; if the execution context includes the unprivileged application mode, then: incrementing a program counter value; storing the program counter value in a system stack, wherein the program counter value includes an address of an instruction in the given instruction set to be executed upon completion of the system routine; storing context information on the system stack; changing the execution context to a privileged context; and jumping to a predefined address where a system call handler is located; if the execution context is a privileged supervisor mode, then: incrementing the program counter value; storing the program counter value in a system stack, wherein the program counter value includes an address of an instruction to be executed upon completion of the system routine; storing context information on the system stack; and jumping to the predefined address where the system call handler is located; and if the execution context is any of a plurality of other privileged modes, then: incrementing the program counter value; moving the program counter value into a link register, wherein the program counter value includes an address of an instruction to be executed upon completion of the system routine; and jumping to the predefined address where the system call handler is located.