A method of exception handling in a computer system, the computer system including a physical central processing unit (PCPU) and a system memory, the system memory storing a first stack, a second stack, and a double fault stack associated with the PCPU, the method comprising:
- calling, by the PCPU, a second exception handler in response a stack overflow condition of the first stack caused a first exception handler, the first and second exception handlers executing in the computer system;
- storing, by the second exception handler, an exception frame on the double fault stack in response to the stack overflow condition of the first stack;
- switching, by the second exception handler, a first stack pointer of the PCPU from pointing to the first stack to pointing to the double fault stack;
- setting a current stack pointer of the PCPU to the first stack pointer;
- and
- executing software on the PCPU with the current stack pointer pointing to the double fault stack.