Priceless

[컴퓨터] Computer Systems: A Programmer's Perspective 챕터3 정리 본문

CS

[컴퓨터] Computer Systems: A Programmer's Perspective 챕터3 정리

Hyun__ 2023. 11. 7. 20:23

Computer Systems: A Programmer's Perspective 

위 책의 내용을 정리하였습니다

 

Chapter 3: Machine-Level Representation of Programs(프로그램의 기계 수준 표현)

amd가 x86에 대해 먼저 개발했다

3-1. A Historical Perspective(역사적 관점)

micro architecture는 어샘블리 수준에서 이해

Instructure Set Architecture는 아키텍처

3-2. Program Encodings(프로그램 인코딩)

3-2-1

 

3-2-2

pushq: 스택에 저장하여 레지스터에 백업한다

movq: 오른쪽으로 옮긴다(intel 시스템)

 

diassemble 로 취약점을 찾을 수 있다

머신 코드를 assembly어로

 

 

eax 와 rax의 차이점

다른 레지스터는 아니라 같은 레지스터를 크기를 다르게 할당할 수 있다

rax는 64비트, eax는 32bit, 16bit %ax 

 

3-3. Data Formats(데이터 형식)

애매모호한 정의로 인해 word 라는 표현은 잘 쓰지 않는다

16bit 32 64 와 같이 표현

 

3-4. Accessing Information(정보 접근)

move zero extension 이랑 move sign extension의 차이점?

 

어셈블리에서 괄호를 씌워 

rdx에 있는 메모리에 있는 주소값을 옮긴다

 

푸쉬 하면 stack pointer가 줄어들고 값이 저장된다

3-5. Arithmetic and Logical Operations(산술 및 논리 연산)

movq 를 

leaq 옮기지 않고 복사한다? 참조?

첫 번째를 참조하는데 연산자로 사용하지 않는다

 

leaq (%rdx, %rdx,2) %rax : 3* z

그냥 곱하는 것이 아닌 위와 같이 나온 이유가 뭘까?

메모리를 접근하지 않기 위한 방법일지도

 

 

 

3-6. Control(제어)

 

3-7. Procedures(과정)

 

3-8. Array Allocation and Access(배열 할당 및 접근)

 

3-9. Heterogeneous Data Structures(다양한 데이터 구조)

 

3-10. Putting It Together: Understanding Pointers(포인터와 메모리 주소)

 

3-11. Life in the Real World: Using the gdb Debugger(GBD 디버거 사용)

 

3-12. Out-of-Bounds Memory References and Buffer Overflow
(메모리 범위를 벗어나는 메모리 참조와 오버플로우)

 

3-13. x86-64: Extending IA32 to 64 Bits(x86_64 아키텍처)

 

3-14. Machine-Level Representations of Floating-Point Programs(부동 소수점 프로그램의 기계 수준 표현)

 

4-1부터 4-3