I am working on multithreading, and I am wondering what
exactly an IRET does.
While I know that it pops cs, eip, and eflags off the stack, the struct that I borrowed for my interrupt handler has 2 more value: ss and esp. Do these also get popped off during an IRET? and if they do, does the interrupt always push them?
Confused.
Here is my struct (I pass a pointer to it every interrupt):
Code:
struct x86_registers
{
uint32_t gs, fs, es, ds;
uint32_t edi, esi, ebp, esp, ebx, edx, ecx, eax;
uint32_t int_no, err_code;
uint32_t eip, cs, eflags, useresp, ss;
};
However, I have some simple code running that (for now) dumps the registers of the interrupted process on every interrupt. while the 'esp' value seems to correspond to a sane esp, 'useresp' has all sorts of odd values, even settling in at zero sometimes. Also, I read that popa doesn't pop esp. therefore, is the esp pushed by pusha valid?
EDIT: Here is a screenshot of registers:
Attachment:
VirtualBox_Clement_02_02_2017_12_55_49.png [ 12.25 KiB | Viewed 3205 times ]
Thank you!