mov

Why is mov turing complete?

回眸只為那壹抹淺笑 提交于 2021-02-13 11:41:48
问题 I found this recently: https://github.com/xoreaxeaxeax/movfuscator It seems to be contingent on the fact that mov is turing-complete. Is that true, and why? 回答1: Yes, x86's mov is Turing complete. I added that tag to your question because it may not be true for other ISAs with an instruction called mov , and the movfuscator compiler only targets x86. It's not "mov" itself doing computation , it's x86 addressing modes which can do addition (and bit-shift). I haven't looked in detail at how it

Why is mov turing complete?

北城余情 提交于 2021-02-13 11:41:27
问题 I found this recently: https://github.com/xoreaxeaxeax/movfuscator It seems to be contingent on the fact that mov is turing-complete. Is that true, and why? 回答1: Yes, x86's mov is Turing complete. I added that tag to your question because it may not be true for other ISAs with an instruction called mov , and the movfuscator compiler only targets x86. It's not "mov" itself doing computation , it's x86 addressing modes which can do addition (and bit-shift). I haven't looked in detail at how it

Why movzbl is used in assembly when casting unsigned char to signed data types?

风流意气都作罢 提交于 2021-02-10 11:37:04
问题 I'm learning data movement( MOV ) in assembly. I tried to compile some code to see the assembly in a x86_64 Ubuntu 18.04 machine: typedef unsigned char src_t; typedef xxx dst_t; dst_t cast(src_t *sp, dst_t *dp) { *dp = (dst_t)*sp; return *dp; } where src_t is unsigned char . As for the dst_t , I tried char , short , int and long . The result is shown below: // typedef unsigned char src_t; // typedef char dst_t; // movzbl (%rdi), %eax // movb %al, (%rsi) // typedef unsigned char src_t; //

Why movzbl is used in assembly when casting unsigned char to signed data types?

回眸只為那壹抹淺笑 提交于 2021-02-10 11:36:30
问题 I'm learning data movement( MOV ) in assembly. I tried to compile some code to see the assembly in a x86_64 Ubuntu 18.04 machine: typedef unsigned char src_t; typedef xxx dst_t; dst_t cast(src_t *sp, dst_t *dp) { *dp = (dst_t)*sp; return *dp; } where src_t is unsigned char . As for the dst_t , I tried char , short , int and long . The result is shown below: // typedef unsigned char src_t; // typedef char dst_t; // movzbl (%rdi), %eax // movb %al, (%rsi) // typedef unsigned char src_t; //

Difference between memory and register

不羁的心 提交于 2021-02-07 04:35:13
问题 I saw assembly code like, MOV [EAX], EBX the above line, They are mentioned [EAX] is memory and EBX is Register. So, here what is the difference between [EAX] and EBX . What will happen in above instruction. 回答1: In this syntax, brackets around a register means a memory location is used (as source or destination, according to the instruction) with starting address specified at the register (EAX in your case). For example, if EAX contained 1344 before the instruction, value from EBX is copied

Why use RIP-relative addressing in NASM?

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-06 09:25:50
问题 I have an assembly hello world program for Mac OS X that looks like this: global _main section .text _main: mov rax, 0x2000004 mov rdi, 1 lea rsi, [rel msg] mov rdx, msg.len syscall mov rax, 0x2000001 mov rdi, 0 syscall section .data msg: db "Hello, World!", 10 .len: equ $ - msg I was wondering about the line lea rsi, [rel msg] . Why does NASM force me to do that? As I understand it, msg is just a pointer to some data in the executable and doing mov rsi, msg would put that address into rsi .

Very large address copied as negative value

你。 提交于 2021-02-04 19:51:10
问题 I was going through a binary file corresponding to a C program. I have a very large address stored in %eax . When tried to see the value via gdb , it prints a negative value (reason here). Now when mov %eax, 0x4c(%esp) is performed, the resulted value in 0x4c(%esp) is sometimes positive and sometimes negative. This effect cmp $0, 0x4c(%esp) statement that follows! Can someone please explain this behavior? If this helps: core: ELF 32-bit LSB core file Intel 80386, version 1 (SYSV), SVR4-style

X86: What does `movsxd rdx,edx` instruction mean?

烂漫一生 提交于 2020-08-07 09:23:48
问题 I have been playing with intel mpx and found that it adds certain instructions that I could not understand. For e.g. (in intel format): movsxd rdx,edx I found this, which talks about a similar instruction - MOVSX . From that question, my interpretation of this instruction is that, it takes double byte (that's why there is a d in movsxd ) and it copies it into rdx register (in two least significant bytes) and fills the rest with the sign of that double byte. Is my interpretation correct (I

X86: What does `movsxd rdx,edx` instruction mean?

烈酒焚心 提交于 2020-08-07 09:18:49
问题 I have been playing with intel mpx and found that it adds certain instructions that I could not understand. For e.g. (in intel format): movsxd rdx,edx I found this, which talks about a similar instruction - MOVSX . From that question, my interpretation of this instruction is that, it takes double byte (that's why there is a d in movsxd ) and it copies it into rdx register (in two least significant bytes) and fills the rest with the sign of that double byte. Is my interpretation correct (I

X86: What does `movsxd rdx,edx` instruction mean?

谁说我不能喝 提交于 2020-08-07 09:17:32
问题 I have been playing with intel mpx and found that it adds certain instructions that I could not understand. For e.g. (in intel format): movsxd rdx,edx I found this, which talks about a similar instruction - MOVSX . From that question, my interpretation of this instruction is that, it takes double byte (that's why there is a d in movsxd ) and it copies it into rdx register (in two least significant bytes) and fills the rest with the sign of that double byte. Is my interpretation correct (I