엔지니어가 되고 싶은 공돌이
06. Assembly 1: Basic Operations 본문
6. 1. Assembly Instruction
- Moving Data Instruction: movl(source, destination)
- Operand Types: Constant Integer Data / Register(주로 변수) / Memory(주로 포인터)
Mem와 Mem사이의 데이터 교환은 one clock에 two instruction이기 때문에 불가능합니다.
- ex) movl 12(%ebp), %ecx : %ebp +12 -> %ecx.
movl (%edx, %ecx), %ebx : %edx + %ecx -> %ebx.
movl (%edx, %ecx, 4), %ebx : %edx + %ecx X 4 -> %ebx.
- ( )는 레지스터 내부가 특정 값이 아닌 주소이며,
그 메모리 주소로 찾아가 값을 가져오라는 의미.
- movl 외에도 addl, subl, mull, andl, orl 등으로,
다양한 Arithmetics, Logic Operations이 가능합니다.
- incl Dest (Dest = Dest + 1),
decl Dest(Dest = Dest - 1),
notl Dest(Dest = ~Dest) 처럼
one operand 연산자도 존재합니다.
- movl 외에 leal이 있는데 이 명령어는 바로 주소연산을 수행하기에, movl을 사용했을 때보다 상대적으로 연산을 줄일 수 있습니다.
6. 2. Process in Memory
1) Stack: Runtime Stack. [static X int and array and pointer]
2) Heap: 동적으로 할당된 저장소. [malloc(), calloc(), new()]
3) DLLs: 동적으로 링크된 라이브러리로 Heap 내부에 존재.
4) Data: 정적으로 할당된 데이터. [함수바깥에 선언된 변수, Static ]
5) Text: 실행가능한 Machine Instructions.
'Computer Science > System Programming' 카테고리의 다른 글
07. Assembly 2: Control Flow (0) | 2025.02.07 |
---|---|
05. Program and Instruction Set (0) | 2025.02.06 |
04. Byte Ordering (0) | 2025.02.05 |
03. Representation of Floating Points (0) | 2025.02.04 |
02. Representation of Integer (0) | 2025.02.03 |