according to the Intel Manual Volume 3A, Chapter 6, Section 12.1, Figure 6-4:
if the privilege level doesn't change (meaning the exception happened in CPL 0) the stack is:
- EFLAGS
CS
EIP
Error Code
so the parameter definitions should be according to the cdecl calling convention
Code: Select all
(unsigned int err, unsigned int eip, unsigned int cs, unsigned int eflags)
and
(unsigned int eip, unsigned int cs, unsigned int eflags)
not
Code: Select all
(unsigned int cs,unsigned int err, unsigned int eip, unsigned int eflags)
and
(unsigned int cs, unsigned int eip, unsigned int eflags)
and in the event of a privilege level change (CPL 3 and interrupt's DPL is 0) the handler's stack is:
- SS
ESP
EFLAGS
CS
EIP
Error Code