addressing-mode

Why does this MOVSS instruction use RIP-relative addressing? [duplicate]

岁酱吖の 提交于 2019-12-17 17:07:40
问题 This question already has an answer here : Why is the address of static variables relative to the Instruction Pointer? (1 answer) Closed last year . I found the following assembly code in disassembler (floating point logic c++). 842: movss 0x21a(%rip),%xmm0 I understand that when process rip will allways be 842 and this 0x21a(%rip) will be const. It seems a little odd to use this register. I want to know is there any advantage of using rip relative address, instead other addressing. 回答1: RIP

A couple of questions about [base + index*scale + disp]

帅比萌擦擦* 提交于 2019-12-17 07:38:11
问题 The general form for memory addressing in Intel and AT&T Syntax is the following: [base + index*scale + disp] disp(base, index, scale) My questions are the following: Can base and index be any register? What values can scale take, is it 1, 2, 4 and 8 (with 1 being the default)? Are index and disp interchangeable (with the only difference being that index is a register while disp is an immediate value)? 回答1: This is described in Intel's manual: 3.7.5 Specifying an Offset The offset part of a

Addressing Modes in Assembly Language (IA-32 NASM)

旧街凉风 提交于 2019-12-17 06:45:49
问题 As the web-resources on this is sparse, I will, for the benefit of future searches, begin by listing the address modes for IA-32 Assembly Language (NASM) and then follow up with a quick question. Register addressing mov eax, ebx: Copies what is in ebx into eax mov esi, var: Copies address of var (say 0x0040120e) into esi Immediate addressing (second operand is an immediate constant) mov bx, 20: 16-bit register bx gets the actual value 20 Direct memory addressing (directly loads from memory

Addressing Modes in Assembly Language (IA-32 NASM)

走远了吗. 提交于 2019-12-11 04:10:30
问题 As the web-resources on this is sparse, I will, for the benefit of future searches, begin by listing the address modes for IA-32 Assembly Language (NASM) and then follow up with a quick question. Register addressing mov eax, ebx: Copies what is in ebx into eax mov esi, var: Copies address of var (say 0x0040120e) into esi Immediate addressing (second operand is an immediate constant) mov bx, 20: 16-bit register bx gets the actual value 20 Direct memory addressing (directly loads from memory

I'm not exactly sure what this x86 Add instruction is doing

左心房为你撑大大i 提交于 2019-12-08 16:41:37
问题 I'm not exactly sure what this add instruction is doing: add 0x0(%rbp,%rbx,4),%eax If it were: add %rbx,%eax I know it would add the contents of rbx and the contents in eax and store them back into eax . However, the 0x0(%rbp,%rbx,4) is throwing me off. 回答1: That's because it's stupid&confusing AT&T syntax. In normal Intel syntax it's add eax,dword ptr[rbp+4*rbx+0] ie add the dword at rbp+4*rbx to eax. 来源: https://stackoverflow.com/questions/7544672/im-not-exactly-sure-what-this-x86-add

Memory indirect addressing movl - assembly

亡梦爱人 提交于 2019-12-07 16:26:50
问题 I'm trying to understand how exactly memory indirect addressing works in assembly language with AT&T syntax. movl (%eax), %ebx movl %eax, (%ebx) Here is a similar question that explains about memory indirect addressing This is what I've understood: In the first case, you load the data pointed to by the register %eax and store it in %ebx . In the second case, you store the data in the register %eax to the address space pointed to by the register %ebx . Am I correct? 回答1: Basically the syntax

Register addressing mode vs Direct addressing mode

╄→尐↘猪︶ㄣ 提交于 2019-12-06 06:04:54
问题 I encountered this question in a test paper. It stated, Which of the given addressing modes is faster? Why? Register addressing mode Direct addressing mode Now according to me register addressing mode should be faster as register is the fastest memory location in the computer. Is this the correct answer to it? Please help out. Thanks 回答1: Register accesses are the fastest. However, memory accesses can be as fast if the memory data that you're accessing is already in the CPU's data cache. 回答2:

Memory indirect addressing movl - assembly

微笑、不失礼 提交于 2019-12-05 18:50:04
I'm trying to understand how exactly memory indirect addressing works in assembly language with AT&T syntax. movl (%eax), %ebx movl %eax, (%ebx) Here is a similar question that explains about memory indirect addressing This is what I've understood: In the first case, you load the data pointed to by the register %eax and store it in %ebx . In the second case, you store the data in the register %eax to the address space pointed to by the register %ebx . Am I correct? Basically the syntax is movl source, destination So movl (%eax), %ebx is indeed copy the value at address pointed to by %eax into

What is the meaning of x86 instruction “call dword ptr ds:[00923030h]”?

蹲街弑〆低调 提交于 2019-12-04 09:25:24
问题 What does the following x86 assembler instruction do? call dword ptr ds:[00923030h] It's an indirect call I suspect, but exactly how does it compute the address to the call? 回答1: [EDIT] Updated Whenever you see a memory operand that looks something like ds:0x00923030 , that's a segment-relative addressing mode. The actual address being referred tp is at linear address 0x00923030 relative to the base address of the ds segment register. Memory segmentation in the x86 architecture is somewhat

Assembly (,%eax,4)

喜你入骨 提交于 2019-12-04 03:40:07
问题 If one of my command lines says: jmp *0x804a180(,%eax,4) what does that mean? I ask specifically because there is no value before the first comma and I'm not sure exactly what the * before the address means. 回答1: This instruction jumps to the location whose value is located at the address calculated as %eax * 4 + 0x804a180 . The * is used in AT&T syntax to indicate indirect jumps and calls. It basically means "jump to the location pointed to by this, instead of the value of this". It is