I want to read the CPU flags by pushing them onto the stack and then pop them to a register like this:
uint32_t getEflags() {
uint32_t eflags;
asm ("pushf");
asm ("pop %eax");
asm ("mov %%eax, %0" : "=r"(eflags));
return eflags;
}
Now I saw that this is a mistake because pushf only pushes the lower 16 bits of the EFLAGS, and I'm then popping them into a 32 bit register (i would need pushfd).
That means I'm basically popping more than I'm initially pushing - what happens with my stack when returning here?