addressing-mode

rbp not allowed as SIB base?

怎甘沉沦 提交于 2019-11-26 23:20:19
I'm quite new to x86-64 binary encoding. I'm trying to fix some old "assembler" code. Anyways, I'm trying to do something like this (Intel syntax): mov [rbp+rcx], al The assembler is currently generating this: 88 04 0D but that doesn't seem to be a valid instruction. If I change out the base in the SIB-byte from rbp to some other register, it works fine. Another way to make it work is to add a one byte displacement of zero ( 88 44 0D 00 ). This seems to happen with other similar opcodes. Why can't I use rbp there with mod=00 ? Peter Cordes The encoding that would mean rbp is an escape code for

How does “mov (%ebx,%eax,4),%eax” work? [duplicate]

无人久伴 提交于 2019-11-26 14:48:50
问题 This question already has answers here : What is the meaning of MOV (%r11,%r12,1), %edx? (2 answers) Closed 2 years ago . Been working on an assembly assignment, and for the most part I understand assembly pretty well. Or well at least well enough for this assignment. But this mov statement is tripping me up. I would really appreciate if someone could just explain how this mov statement is manipulating the register values. mov (%ebx,%eax,4),%eax P.S. I wasnt able to find this specific type of

What is the meaning of MOV (%r11,%r12,1), %edx?

对着背影说爱祢 提交于 2019-11-26 12:32:51
问题 What does this instruction do? mov (%r11,%r12,1), %edx 回答1: Look here. It says In the AT&T Syntax, memory is referenced in the following way, segment-override:signed-offset(base,index,scale) Down on the page there are some examples. I find this the best: GAS memory operand NASM memory operand ------------------ ------------------- (%ecx,%ebx,2) [ecx+ebx*2] mov source, destination in AT&T syntax copies the value from source to destination. Also consider the size of edx. How many bytes (4) do

NASM x86 16-bit addressing modes

 ̄綄美尐妖づ 提交于 2019-11-26 08:57:35
I am having trouble with pointing to a address and write in my case a variable of byte in size. This gives me the error "error: invalid effective address": mov byte[AX], byte 0x0 After some trail and error i tested the same but with EAX. This compiles just fine: mov byte[EAX], byte 0x0 What am I missing here? Alexey Frunze [AX] is an invalid memory operand specification. The valid 16-bit ones are : [constant] [BX] [SI] [DI] [BX+constant] [BP+constant] [SI+constant] [DI+constant] [BX+SI] [BX+DI] [BP+SI] [BP+DI] [BX+SI+constant] [BX+DI+constant] [BP+SI+constant] [BP+DI+constant] [BP] is formally

rbp not allowed as SIB base?

谁说我不能喝 提交于 2019-11-26 08:39:02
问题 I\'m quite new to x86-64 binary encoding. I\'m trying to fix some old \"assembler\" code. Anyways, I\'m trying to do something like this (Intel syntax): mov [rbp+rcx], al The assembler is currently generating this: 88 04 0D but that doesn\'t seem to be a valid instruction. If I change out the base in the SIB-byte from rbp to some other register, it works fine. Another way to make it work is to add a one byte displacement of zero ( 88 44 0D 00 ). This seems to happen with other similar opcodes

NASM x86 16-bit addressing modes

∥☆過路亽.° 提交于 2019-11-26 01:49:58
问题 I am having trouble with pointing to a address and write in my case a variable of byte in size. This gives me the error \"error: invalid effective address\": mov byte[AX], byte 0x0 After some trail and error i tested the same but with EAX. This compiles just fine: mov byte[EAX], byte 0x0 What am I missing here? 回答1: [AX] is an invalid memory operand specification. The valid 16-bit ones are: [constant] [BX] [SI] [DI] [BX+constant] [BP+constant] [SI+constant] [DI+constant] [BX+SI] [BX+DI] [BP

Referencing the contents of a memory location. (x86 addressing modes)

谁说胖子不能爱 提交于 2019-11-25 23:57:35
问题 I have a memory location that contains a character that I want to compare with another character (and it\'s not at the top of the stack so I can\'t just pop it). How do I reference the contents of a memory location so I can compare it? Basically how do I do it syntactically. 回答1: For a more extended discussion of addressing modes (16/32/64bit), see Agner Fog's "Optimizing Assembly" guide, section 3.3. That guide has much more detail than this answer for relocation for symbols and or 32bit