How to read and write x86 flags registers directly?

前端 未结 6 890
执笔经年
执笔经年 2020-11-29 05:07

From what I\'ve read, seems like there are 9 different flags. Is it possible to read/change them directly? I know I can know for example if the zero flag is set after doing

6条回答
  •  感动是毒
    2020-11-29 05:52

    Simplest way is using pushf/popf.

    If you want to move eflags into eax, use code below.

    pushf                  # push eflags into stack
    pop %eax               # pop it into %eax
    

提交回复
热议问题