SEH in RISC Environments (Windows Embedded CE 6.0)

1/5/2010

In a RISC environment, data structures associated with exception processing are calculated at compile time, and written to the data sections of the module being built.

To locate appropriate handlers when an exception occurs in Win32 environments other than x86, the system first determines the frames that reside on the callstack, along with their associated functions in code. Any function can have a handler associated with it. If so, the system gives the handler associated with the function an opportunity to handle the exception.

As with x86, a RISC system invokes handlers in reverse order; that is, it first invokes the handler whose corresponding frames were most recently pushed onto the stack.

Reverse Execution Process

To determine the frames on the stack, the system simulates the execution of a portion of each function's code in reverse. This simulation creates a CPU context similar to the state the real CPU context held at the point of entry to that function.

This process of reverse execution is known as virtual unwinding because the stack unwind is only being simulated, not actually performed.

For more information, see Virtual Unwinding.

The portion of the code that is actually unwound is called the Prolog of the function. To virtually unwind, the system uses information contained in data structures called PDATA Structures.

The compiler generates correct Prolog and Epilog sequences, and PDATA for functions that it compiles, but you must create appropriate code and PDATA for functions you write in assembly language.

The prolog and epilog sequence must adhere to strict guidelines for Virtual Unwinding to work.

For details on acceptable prologs and epilogs, see the documentation for your target platform.

See Also

Reference

Prolog-Epilog Example

Concepts

Prolog
Epilog
Virtual Unwinding

Other Resources

Exception Handling for Device Compilers