rosieblue
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

https://www.thesecuritybuddy.com/reverse-engineering/what-are-byte-ptr-word-ptr-dword-ptr-and-qword-ptr-directives-in-x86-and-x64-assembly/

 

What are BYTE PTR, WORD PTR, DWORD PTR and QWORD PTR directives in x86 and x64 assembly? - The Security Buddy

BYTE PTR, WORD PTR, DWORD PTR, and QWORD PTR are directives in x86 and x64 assembly that specify the referenced data is 8-bit, 16-bit, 32-bit, or 64-bit in size. For example, mov DWORD PTR [rax],0x1 The above assembly instruction specifies that the 32-bit

www.thesecuritybuddy.com

http://www.c-jump.com/CIS77/ASM/Instructions/I77_0250_ptr_pointer.htm

 

Directives BYTE PTR, WORD PTR, DWORD PTR

To get around this instance, we must use a pointer directive, such as mov BYTE PTR [ESI], 5 ; Store 8-bit value mov WORD PTR [ESI], 5 ; Store 16-bit value mov DWORD PTR [ESI], 5 ; Store 32-bit value

www.c-jump.com

https://stackoverflow.com/questions/55916891/difference-between-mov-and-mov-ptr

 

Difference between MOV and MOV ptr

I don't understand the difference between MOV and MOV ptr. For example, in this C code: unsigned char x, y; x = 2; the second line in assembly is: `MOV x, 2` but the second line of this C cod...

stackoverflow.com

 

profile

rosieblue

@Rosieblue

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!