1. A method of providing secure access of an execution-state-transition routine in a first software layer from a second software layer, the method comprising: inserting a call, into the second software layer to the execution-state-transition routine in a computer system, wherein the call specifies a transition to a specified execution state and indicates an execution resumption point within the second software layer by passing to the execution-state-transition routine a return pointer; during execution of the second and first software layers in the computer system, maintaining a callpoint log to track a current execution state; and the called execution-state-transition routine determining based on the specified execution state, the return pointer, and the current execution state retrieved from the callpoint log whether the transition to the specified execution state is allowed, wherein determining whether the transition to the specified execution state is allowed comprises accessing an allowed-transitions table to determine if any entry exists in the allowed-transitions table that corresponds to a combination of the specified execution state, the return pointer, and the current execution state retrieved from the callpoint log.