ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [2021/09/28][짤막한 이야기 - EFLAGS]
    짤막한 이야기 2021. 9. 28. 08:31
    728x90
    반응형

    [2021/09/28][짤막한 이야기 - EFLAGS]
    "EFLAGS"는 레지스터의 한 종류이며 Extended FLAGS 레지스터라고 생각하면 편하다.
    플래그 레지스터는 범용 레지스터(EAX, EBX, ECX 등등. 32비트 운영체제 기준 4바이트로 구성됨)와 달리 특정 상황을 0과 1로 표현한다.
    예를 들어 제로플래그(ZF)가 1인 경우 이번 연산의 결과로 0을 생성하였다는 의미이다.
    0과 1은 1비트로 표현가능하기 때문에 범용 레지스터와 같은 크기로 할당하면 불필요한 공간이 많이 소비된다.
    따라서 모든 플래그(ZF, SF, CF, OF 등등) 레지스터를 합하여 하나의 EFLAGS 레지스터(4바이트)에 할당하는 것이다.
    예를 들어, EFLAGS의 6번째 비트가 ZF를 나타내는 것이다.
    이것이 중요한 이유는 두 가지이다.
    첫 번째는 모든 조건분기문(JNZ, JZ, JG 등등)은 이 EFLAGS를 확인하여 분기 여부를 결정하기 때문에 제어흐름 파악에 매우 중요한 레지스터이다.
    두 번째는 PinTool에서 모든 레지스터 값을 획득하거나 변조할 수 있으며, 이 EFLAGS 레지스터 또한 마찬가지이기 때문에 구조를 파악하는 것이 매우 중요하다.
    즉, 분기문이 포함된 프로그램의 제어흐름을 변형하기 위해서는 아주 간단한 형태라도 조건분기문의 의미와 문법을 학습하는 것이 중요하다.
    [관련된 문서 - 핀툴 프로그래밍 기본서[제2부. 핀툴로 AbexCrackMe#1 크랙하기]]
    #이야기 #루니프 #핀 #핀툴 #레지스터 #범용 #EFLAGS #제어흐름 #변조 #조건분기문 #크랙

    [2021/09/28][Short Story - EFLAGS]
    "EFLAGS" is a type of register and it is convenient to think of it as an Extended FLAGS register.
    Unlike general-purpose registers (EAX, EBX, ECX, etc., which are composed of 4 bytes), flag registers express specific situations as 0 and 1.
    For example, if the zero flag (ZF) is 1, it means that 0 is generated as a result of this operation.
    Since 0 and 1 can be expressed with 1 bit, a lot of unnecessary space is consumed when allocating the same size as a general-purpose register.
    Therefore, all flags (ZF, SF, CF, OF, etc.) registers are summed and allocated to one EFLAGS register (4 bytes).
    For example, the 6th bit of EFLAGS indicates ZF.
    This is important for two reasons.
    First, all conditional branch statements (JNZ, JZ, JG, etc.) check EFLAGS to determine whether to branch, so it is an important register for understanding control-flow.
    Second, you can get or modify all registers with PinTool, and this EFLAGS register is also, so it is very important to know the structure.
    In other words, it is important to learn the semantic and syntax of conditional branch statements in order to modify the control-flow of a program that includes branch statements.
    [Related Documents - Basic Book for PinTool Programming[Part2. AbexCrackMe#1 with PinTool]]
    #Story #LootNiP #Pin #PinTool #Register #GeneralPurpose #EFLAGS #ControlFlow #Modify #ConditionalBranchStatement #Crack

    728x90
    반응형
Designed by Tistory.