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
1
vote
1 answer

Encoding memory operands using the RSP register in x64 - SIB byte needed?

I'm trying to understand how to encode reads on the RSP register in x86-64. For example, I have some code like this: .section __TEXT,__text .global _main _main: push %rsp push (%rsp) mov %rsp, %rax mov (%rsp), %rax When I assemble and dump…
1
vote
0 answers

PC relative addressing in MIPS

from what I have learnt about PC relative addressing in MIPs, we're supposed to count from PC + 4 to calculate the number of jumps needed in a beq or bne operation. But what if there isn't any other operation that come after this beq or bne? For…
kingsbane
  • 55
  • 5
1
vote
1 answer

What is the point of offset in mips lw and sw instructions?

My teacher just went over the topic but I'm still left questioning why exactly offset is used. Is it to categorize values with the help of a sort of prefix? If you could explain in an easy way of why offset is used in these instructions I'd be…
1
vote
1 answer

What does a minus before an addressing mode mean in assembly, like -0x2(%rbx)

201036: push %rbp 201037: push %rbx 201038: sub $0x28,%rsp 20103c: mov %rsp,%rsi 20103f: callq 2014a5
NoobCoder
  • 513
  • 3
  • 18
1
vote
1 answer

Negative operand in mov.b Instruction

I am currently working to solve the stage Hanoi in the Microcorruption CTF. This CTF focusses on the MSP430 Family (RISC, 16Bit). I stumbled across the following lines: 445c: c443 fcff mov.b #0x0, -0x4(r4) . . . 4472: 5f44 fcff mov.b…
Bassrelic
  • 90
  • 11
1
vote
1 answer

VM Instructions If an exit is possible?

bebc : mov 3423441(%rip),%r11 xor (%rsp),%r11 mov %rdx,%r8 mov %rcx,%r9 test %r8,%r8 jne bee3 mov $0x6c16,%rdi mov $0xc0f4,%rax vmwrite %rax,%rdi pushf For the above instruction, which instruction can…
1
vote
1 answer

Print (%r12,%rbx,1) in GDB

In GDB how do I print 0xc(%rsp)? I saw the above link to print the value when there's two arguments there, but what do I do when there's three? What to do with the offset 1? How to find the address of (%r12,%rbx,1) and print its content?
Siv
  • 43
  • 6
1
vote
1 answer

how can I write an address in a register?

DOSSEG .MODEL SMALL .STACK .DATA PUBLIC SECTOR SECTOR DB 'R', 'o', 'b', 'e', 'r', 't', 'o', '$' .CODE EXTRN WRITE_CHAR:PROC INDEX PROC ; ==================================== 1) MOV AX, DGROUP MOV DS, AX …
Roberto Rocco
  • 450
  • 2
  • 11
1
vote
0 answers

Clarifying three different addressing modes in x86

I am trying to reconcile the differences between the main categories of addressing memory in x86, and want to see if I have the distinctions right. If I'm understanding things correctly, there are three broad ways, each with their own syntax. The…
carl.hiass
  • 1,526
  • 1
  • 6
  • 26
1
vote
0 answers

Accessing array elements using indexed addressing

What is the proper way to access array elements in x86_64? For example, here is what I have going so far: my_array: .word 20,25,30,35 .globl _start _start: movq $0, %rdi # should we use rdi for the offset? movz…
carl.hiass
  • 1,526
  • 1
  • 6
  • 26
1
vote
0 answers

Waht does variable following square brackets mean?

I am trying to use cl.exe to compile my C++ code to asm code: 1 #include 2 3 int main(int argc, char const *argv[]) 4 { 5 int x; 6 printf("Enter X:\n"); 7 scanf("%d", &x); 8 printf("You enterd %d\n",…
Moon soon
  • 2,616
  • 2
  • 30
  • 51
1
vote
1 answer

What is the difference between using "offset" and "[ ]" on memory labels and registers in GAS .intel-syntax assembly?

Using GCC, compiling for 32-bit Intel architecture, with .intel_syntax noprefix. Let's suppose I have the following .data section: A: .int 0x1, 0x2 What is the difference between the following, when used as an operand: A, [A], offset A? Also, what…
1
vote
1 answer

What does the ! character do in ARM assembly?

#include void fun(); int main() { int a = 10; fun(); return 0; } void fun() { int a = 5; } Assembly code. 000103e4
: 103e4: e52db008 str fp, [sp, #-8]! 103e8: e58de004 …
yash
  • 47
  • 5
1
vote
1 answer

How is "!" part of "LDM R1! {R2}" instruction in Armv6-M Architecture Encoded?

When I look at the official Arm specifications, ! Causes the instruction to write a modified value back to . If ! is omitted, the instruction does not change in this way. This is how the function is explained, yet the ASL Code is as…
1
vote
1 answer

what does mean instruction like mov byte ptr [rax + rdx-1], 00 with such offset where rax not pointer

Stuck with study of assembler mov byte ptr [rax+rdx-01],00 RAX=00000004 RDX=2295EA3B878 and mov [r10+rsi],al RAX=0000000000000065 RSI=000002295EA3B878 R10=0000000000000000 It's clear about mov al byte ptr. But i don't understand what means …
user199588
  • 539
  • 2
  • 6
  • 21