I am trying to retrieve the FLAGS register in order to print it out for my “own-made” os (running on Bochs). Since I didn’t find a way to force the printing of that register into the BOCHS log file, I am trying to print it out from my code.
Here is my attempt. (Disclaimer: I am a total ASM noob. Sorry for that …)
u16int eflags()
{
asm volatile ("pushf");
asm volatile ("movw %esp-2, %eax");
}
Of course it does not compile. How can I turn the syntax into something correct please?
Make sure the calling convention specifies that the return value is in the ax/eax register.