1. A method for monitoring access of routines in a first software layer through a second software layer, the method comprising: inserting calls, into the second software layer to one or more execution-state-transition routines, that each specifies a transition and that each indicates the execution resumption point within the second software layer to the execution-state-transition routine by passing to the execution-state-transition routine a return pointer; during execution of the second and first software layers, maintaining a callpoint log to track a cumulative execution state; and in the first software layer routine, determining whether the current, cumulative execution state is compatible with execution of the software layer routine.