Questions tagged [addressing-mode]

An addressing mode specifies how to calculate the effective memory address of an operand by using information held in registers and/or constants contained within a machine instruction or elsewhere.

From Wikipedia (Addressing mode):

Addressing modes are an aspect of the instruction set architecture in most central processing unit (CPU) designs. The various addressing modes that are defined in a given instruction set architecture define how machine language instructions in that architecture identify the operand (or operands) of each instruction. An addressing mode specifies how to calculate the effective memory address of an operand by using information held in registers and/or constants contained within a machine instruction or elsewhere.

296 questions
2
votes
1 answer

x86 lea instruction

I am trying to get a good grip on the LEA instruction in x86: leal (%edx, %edx, 4), %eax leal (%edx, %edx, 2), %eax Given these two lines, i know that: eax = edx + edx*4 and then eax = edx + edx*2 Two questions. First, if these instructions appear…
Chris Dargis
  • 5,891
  • 4
  • 39
  • 63
2
votes
0 answers

What register is riz?

I was disassembling a program and I don't understand what "riz" means here. I don't know of a register with this name. or cl,BYTE PTR [rcx+riz*2+0x65] Can someone explain it to me? Thanks
EW0o
  • 21
  • 1
2
votes
1 answer

Why is a RIP-relative LEA instruction producing a PIC-incompatible R_X86_64_32S relocation?

I'm going through the x86-64 tutorial on exercism.org. I'm using NASM on Linux, producing an ELF binary. There is just a bit of C code that invokes my assembly code in a test harness. Their build system specifies -pie in the LDFLAGS and -fPIE in the…
Hut8
  • 6,080
  • 4
  • 42
  • 59
2
votes
1 answer

Is the Linux paging model an abstraction?

I'm currently reading the Understanding the Linux kernel Third Edition and I'm on chapter 2 about memory addressing. At first the book covers paging in 32 bit, PAE 32 bit, and PSE (we are talking about x86 here). More specifically the anatomy of…
2
votes
1 answer

CS: override on access to global variables in IDA output, like mov eax, cs:x?

I am writing simple programs then analyze them. Today I've written this: #include int x; int main(void){ printf("Enter X:\n"); scanf("%d",&x); printf("You enter %d...\n",x); return 0; } It's compiled into…
Inc.ace
  • 37
  • 5
2
votes
0 answers

nasm: "symbol rip is undefined" - how to use lea-instruction relative to "rip" register?

I'd like to use the instruction lea rax, [rip + 0x1020304] with NASM but it seems like it doesn't allow that use of rip. GAS (GNU Assembler) does allow this syntax for both numbers and symbols (How do RIP-relative variable references like "[RIP +…
phip1611
  • 5,460
  • 4
  • 30
  • 57
2
votes
1 answer

Understanding assembly language operand forms

Address Value Register Value 0x100 0xFF %rax 0x100 0x104 0xAB %rcx 0x1 0x108 0x13 %rdx 0x3 0x10C 0x11 Fill in the following table showing the values…
2
votes
0 answers

Translate from nasm to gas assembly syntax

translate this line: mov [p2_label + ecx * 8], eax what I understand it something like this: movl %eax, (%ebx,%ecx,8) But with label instead %ebx and it's not work for me.
Nms1
  • 21
  • 2
2
votes
1 answer

65(C)02 Will indexed zero page addressing cross page boundary?

I'm building an emulator for the 6502 and 65C02 and I don't have the actual chip (yet). I tried looking this up in the datasheet but it doesn't say what will happen when this occurs: LDA #$FF ; 0xFF -> A LDX #$20 ; 0x20 -> X STA #$F4, X ; A…
FalcoGer
  • 2,278
  • 1
  • 12
  • 34
2
votes
1 answer

MASM: How to resolve Immediate mode Illegal in 8086 programming?

I am solving a fundamental question of Assembly Language Programming to add BCD numbers and two ASCII numbers, for that I got that I have to use DAA and AAA instructions respectively, Now I am trying to store the result stored in AX register into my…
Ankur
  • 457
  • 6
  • 21
2
votes
1 answer

What is the effect of the displacement value on the Mod field of the ModRegRm byte?

I'm writing an 8086 assembler that takes instructions and produce 8086 machine code. I use the "Intel 8086 User Manual" as a reference. To make it clear I will explain the situation. Let's say I wanna assemble this instruction mov ax, bx. I will…
Moe
  • 432
  • 1
  • 6
  • 21
2
votes
2 answers

What is the function of parentheses in MIPS?

I've been working through a project book as an introduction to MIPS and I've come across a problem. One of the lines of code in the book is lb $t3, ($t2). I have no clue what the parentheses do because prior to this, I haven't seen them used, and…
thepufferfish
  • 441
  • 4
  • 17
2
votes
2 answers

What do parentheses surrounding a register mean?

What exactly is the difference resulting from a register being surrounded in parentheses in an operation? For example: movl (%edx), %eax versus movl %edx, %eax Thank you in advance!
Michael Dadi
  • 362
  • 3
  • 12
2
votes
1 answer

movsql call results in a core dump

Based on the core file, the where command was used first then the disassemble command. (gdb) disassemble Dump of assembler code for function prm_get_sta: 0x0000000000414b80 <+0>: push %rbp 0x0000000000414b81 <+1>: mov %rsi,%rbp …
Unhandled Exception
  • 1,427
  • 14
  • 30
2
votes
0 answers

meaning of addresses listed in assembly comments in gdb

In a gdb session, how are the addresses list in the comments of the assembly output computed? To give an example, I am currently on the following instruction: 0x0000555555556140 ? jmpq *0x7af5a(%rip) # 0x5555555d10a0 We…
user001
  • 1,850
  • 4
  • 27
  • 42