Computer Architecture,  Study

[Computer Arch.] x86 Flags (Condition Code) & Registers

1. Flags

x86 machine에서 사용되는 condition code flags들에 대한 정보는 내부 architecture를 분석하는데 매우 중요하다. 내부 register name은 eflags 라는 이름으로 가져간다.

비트약어이름설명
0CFCarry Flag연산시 최상위 비트 (MSB)에서 올림이 발생할 경우 set 된다.
11
2PFParity Flag연산결과 1인 비트수가 짝수라면 set 된다
20
4AFAuxiliary FlagCF 가 Nibble 에 대하여 적용된다
50
6ZFZero Flag연산결과가 0 이 되었을때 set 된다
7SFSign Flag연산결과 MSB 가 1일때 set 된다
8TFTrap Flag하나의 명령어 처리후에 single-step interrupt 를 발생시킨다
9IFInterrupt FlagEnables the external interrupt
10DFDirection FlagIncrement or decrement mode for
11OFOverflow Flag연산결과가 현재 나타낼 수 있는 범위를 초과했을 때 set 된다.
참고
12-13IO-PLI/O Privilege LevelUsed in protected mode operation to select the privilege level for I/O device(00~11).
If current privilege level > IOPL, I/O (IN, INS, OUT, OUTS, CLI, STI) can be executed. Otherwise, an exception occurs (286+ only)
14NFNested TaskInstruction caused nested task switch (286+)
150
16RFResume FlagDebug faults disabled during instruction execution (386+)
17VMVirtual 8086Currently executing 8086 code on virtual processor (386+)
18ACAlignment CheckData aligned to four-byte boundary (486+)
19VIFVirutal interrupt flagA copy of the interrupt flag bit available to the Pentium II processors
20VIPVirtual interrupt pending flagProvides information about a virtual mode interrupt for the Pentium-Pentium II processors. Used in multitasking environment
21IDID FlagCPUID 명령이 지원되는지 나타내는 플래그

2. Registers

64bit32bit16bit8bitDescription
%rax%eax%ax%alReturn value
%rbx%ebx%bx%blCallee saved
%rcx%ecx%cx%cl4th argument
%rdx%edx%dx%dl3th argument
%rsi%esi%si%sil2nd argument
%rdi%edi%di%dil1st argument
%rbp%ebp%bp%bplCallee saved
%rsp%esp%sp%splStack pointer
%r8%r8d%r8w%r8b5th argument
%r9%r9d%r9w%r9b6th argument
%r10%r10d%r10w%r10bCaller saved
%r11%r11d%r11w%r11bCaller saved
%r12%r12d%r12w%r12bCallee saved
%r13%r13d%r13w%r13bCallee saved
%r14%r14d%r14w%r14bCallee saved
%r15%r15d%r15w%r15bCallee saved

Reference

  1. http://www.autonomy.net.au/display/compro/Jumps+CMP+and+TEST

Leave a Reply

Your email address will not be published. Required fields are marked *