Reversing/Information

범용 레지스터 역할

프레딕 2024. 2. 1. 13:54
728x90

여러가지 레지스터가 있는데 그중에서 범용 레지스터만 알아보겠다.

 

  1. EAX : Accumulator for operands and results data
    일반적으로 함수 리턴 값에 사용

  2. EBX : Pointer to data in the dS segment
  3. ECX : Counter for string and loop operations
    반복문 명령어에서 반복 카운트로 사용
  4. EDX : I/O Pointer

  5. EBP : Pointer to data on the stack (in the SS segment)
    EBP는 함수가 호출되었을 때 그 순간의 ESP를 저장하고 있다가, 함수가 리턴하기 직전에 다시 ESP에 값을 돌려주어 스택이 깨지지 않도록 함 (스택 프레임 기법)

  6. ESI : source pointer for string operations
  7. EDI : destination pointer for string operations
  8. ESP : Stack Pointer (in the SS segment)
    스택 메모리 주소를 가리킴

1번부터 4번까지는 산술연산(ADD, SUB, XOR 등)명령어에서 상수/변수 값의 저장 용도로 많이 사용되는 레지스터들이다.

5번부터 8번까지는 메모리 주소를 저장하는 포인터로 사용된다.

728x90
반응형