Learning Win32 Assembly [20]: insight mark register

Source: Internet
Author: User
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
NT Iopl Of DF If TF SF ZF AF PF Cf
Wei
Enable
Use
Embed
Set
Mark
Zhi
I/O
Permission
Flag
Ranking 2
Overflow
Output
Mark
Zhi
Fang
Direction
Mark
Zhi
Medium
Disconnected
Allow
Xu
Mark
Zhi
Single
Step
Mark
Zhi
Character
No.
Mark
Zhi
Zero
Mark
Zhi
Wei
Enable
Use
Auxiliary
Help
Mark
Zhi
Wei
Enable
Use
Odd
Even
Mark
Zhi
Wei
Enable
Use
Into
Bit
Mark
Zhi

The table above shows the 16-bit low of the 32-bit register eflags.

Eflags cannot be read or written directly, but some convenient commands, such:
Lahf: reads eflags 8-bit lower to Ah; sahf is the inverse operation of lahf.

The command STC, CLC, and CMC are respectively set, reset, and reverse for CF (carry mark)
; ‑Flat, stdcallinclude windows. incinclude kernel32.incinclude masm32.incinclude Debug. incincludelib implements masm32.libincludelib Debug. Lib. Data szbin1 dB 8 DUP (?), 0 szbin2 dB 8 DUP (?), 0 szbin3 dB 8 DUP (?), 0 szbin4 dB 8 DUP (?), 0. codemain proc STC; Set CF, cf = 1 lahf invoke byt2bin_ex, ah, ADDR szbin1 clc; reset CF, cf = 0 lahf invoke byt2bin_ex, ah, ADDR szbin2 stc cmc; anti-CF, cf = Not CF lahf invoke byt2bin_ex, ah, ADDR szbin3 clc cmc; anti-CF, cf = Not CF lahf invoke byt2bin_ex, ah, ADDR szbin4 printstring szbin1; xxxxxxx1 printstring szbin2; xxxxxxx0 printstring szbin3; xxxxxxx0 printstring szbin4; xxxxxxx1 retmain endpend main

  

If you want to observe the 32 bits of the entire eflags, you can use the pushfd and popfd commands to enable eflags to go to the stack and exit the stack.

; ‑Flat, stdcallinclude windows. incinclude kernel32.incinclude masm32.incinclude Debug. incincludelib implements masm32.libincludelib Debug. Lib. Data szbin dB 32 DUP (?), 0. codemain proc STC pushfd invoke dw2bin_ex, dword ptr [esp + 4], ADDR szbin popfd printstring szbin; 00000000000000000000001001000111 CLC pushfd invoke dw2bin_ex, dword ptr [esp + 4], ADDR szbin popfd printstring szbin; 00000000000000000000001010000110 retmain endpend main

  

It seems that the data in the mark register is a bit unpredictable. It should not be so observed; pay attention to it later.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.