[컴퓨터시스템프로그래밍] CS:APP Cache Lab csim.c (2) solution
·
ComputerSystemProgramming
까먹고 작성 안했던 세 번째 과제의 solution#include #include #include #include "cachelab.h"/* Globals set by command line args */int verbosity = 0; /* print trace if set */int s = 0; /* set index bits */int b = 0; /* block offset bits */int E = 0; /* associativity */char *trace_file = NULL;/* Derived from command line args */int S; /* number of sets */int B; /* block size (bytes) */int ..
[컴퓨터시스템프로그래밍] CS:APP Bomb lab: Defusing a Binary Bomb (8) sercret_phase
·
ComputerSystemProgramming
secret_phase로 돌입한다. disassemble된 코드를 보면 secret_phase라는 함수를 찾을 수 있다. 이 secret_phase를 진입하는 방법을 찾기 위해 검색해보면, phase_defused 함수에서 secret_phase를 호출하는 부분이 있다. 0000000000001f6f : 1f6f: f3 0f 1e fa endbr64 1f73: 48 83 ec 78 sub $0x78,%rsp 1f77: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax 1f7e: 00 00 1f80: 48 89 44 24 68 mov %rax,0x68(%rsp) 1f85: 31 c0 ..
[컴퓨터시스템프로그래밍] CS:APP Bomb lab: Defusing a Binary Bomb (7) phase_6
·
ComputerSystemProgramming
마지막 phase답게 매우 길다. 앞부분을 먼저 확인해본다. 000000000000183a : 183a: f3 0f 1e fa endbr64 183e: 41 56 push %r14 1840: 41 55 push %r13 1842: 41 54 push %r12 1844: 55 push %rbp 1845: 53 push %rbx 1846: 48 83 ec ..
[컴퓨터시스템프로그래밍] CS:APP Bomb lab: Defusing a Binary Bomb (6) phase_5
·
ComputerSystemProgramming
phase_5는 다른 함수에 비해 조금 짧다.00000000000017ee : 17ee: f3 0f 1e fa endbr64 17f2: 53 push %rbx 17f3: 48 89 fb mov %rdi,%rbx 17f6: e8 94 02 00 00 callq 1a8f 17fb: 83 f8 06 cmp $0x6,%eax 17fe: 75 2c /------------ jne 182c # ...입력한 문..
[컴퓨터시스템프로그래밍] CS:APP Bomb lab: Defusing a Binary Bomb (5) phase_4
·
ComputerSystemProgramming
phase_4의 앞부분을 보면 다른 phase들처럼 sscanf 가 호출된다. 0000000000001775 : 1775: f3 0f 1e fa endbr64 1779: 48 83 ec 18 sub $0x18,%rsp 177d: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax 1784: 00 00 1786: 48 89 44 24 08 mov %rax,0x8(%rsp) 178b: 31 c0 xor %eax,%eax 178d: 48 8d 4c 24 04 ..
[컴퓨터시스템프로그래밍] CS:APP Bomb lab: Defusing a Binary Bomb (4) phase_3
·
ComputerSystemProgramming
phase_3은 코드가 꽤 길다. 알아보기 편하게 jump 구조를 표시해주었다.0000000000001679 : 1679: f3 0f 1e fa endbr64 167d: 48 83 ec 18 sub $0x18,%rsp 1681: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax 1688: 00 00 168a: 48 89 44 24 08 mov %rax,0x8(%rsp) 168f: 31 c0 xor ..
zerogod-ai-dev
'ComputerSystemProgramming' 카테고리의 글 목록