728x90
헷갈리는 거 정리
mov rax, rbx <=rbx를 rax에 대입
mov rax, [rbx] <=rbx가 가리키는 애를 rax에 대입
mov [rax], rbx <=rbx의 값을 rax이 가리키는 위치에 대입
mov [rax], 0x1 <= 오류. 왜냐하면 operand 사이즈가 정해지지 않았으므로 [rax]에 얼마나 저장해야할지 모름
따라서 만약 8bit 짜리 value를 [rax]에 저장하고 싶으면
mov BYTE PTR [rax], 0x1 이라고 해야함 (뭔소리야 ㅅㅂ)
mov BYTE PTR [ebx], 2 ; Move 2 into the single byte at the address stored in EBX.
mov WORD PTR [ebx], 2 ; Move the 16-bit integer representation of 2 into the 2 bytes starting at the address in EBX.
mov DWORD PTR [ebx], 2 ; Move the 32-bit integer representation of 2 into the 4 bytes starting at the address in EBX.
mov BYTE PTR[0x400000], 0x57 <= 0x400000이 가리키는 위치에 1byte만큼 0x57 저장
[blahblah]는 blahblah가 가리키는 위치의 데이터
시간 날 때마다 더 추가하겠다.
References
http://www.c-jump.com/CIS77/ASM/Instructions/I77_0250_ptr_pointer.htm
https://stackoverflow.com/questions/55916891/difference-between-mov-and-mov-ptr
'🖥️ Computer Science > System' 카테고리의 다른 글
[System] 메모리 주소 (x64, x32, 64bit, 32bit) (0) | 2023.03.29 |
---|---|
[Pwnable] 시스템콜(syscall), 셸, 커널모드 vs 유저모드 (0) | 2023.03.26 |
[Assembly] 어셈블리어 필수 명령어 정리본 (스택 관련) (0) | 2023.03.26 |
[System] 컴퓨터 메모리 구조 / 레이아웃 (0) | 2023.03.19 |
[System] 컴퓨터 구조, 폰 노이만 구조, x86-64, 레지스터 (0) | 2023.03.17 |