Questions tagged [relative-addressing]

49 questions
2
votes
1 answer

Why gdb shows different addresses in RIP-relative mode from absolute address?

Having this in c: #include #include int x; int main(){ printf("eneter x\n"); scanf("%i",&x); printf("you enetered: %i\n", x); return 0; } in gdb: starti disas main 0x0000555555555155 <+0>: push %rbp …
autistic456
  • 183
  • 1
  • 10
2
votes
1 answer

using relative addressing for API inside Axios request

I'm working on an application where the URL/path to the API's CRUD functions are defined like so: var newApiAddresses = { itemsGet: "url('itembook_test_api_v1_apiitems_getitems'); ?>", itemAdd: "
jimiss
  • 119
  • 1
  • 1
  • 9
2
votes
0 answers

Is there a method to localize literal pool in C like "ltorg" in assembly?

I am implementing a C function which will be copied to an other memory location during run time. I have avoided function calls inside it, only using pure constant inside it. When I examine the assembly output, the constant access is translated into…
Eric Sun
  • 777
  • 6
  • 20
2
votes
2 answers

How can I jump relative to the PC using the gnu assembler for AVR?

I have a binary file that I've disassembled using avr-objcopy. The interrupt vector table looks like: 00000000 : ; VECTOR TABLE 0: 13 c0 rjmp .+38 ; 0x28, RESET 2: b8 c1 rjmp .+880 ; 0x374,…
1
vote
1 answer

Video not playing in ASP.NET Core MVC

I created a project with ASP.NET Core 6 MVC web app. In this project, videos are uploaded. To prevent all users from accessing the videos, a folder named "File" was created outside the wwwroot and the videos were uploaded to the File folder. Videos…
1
vote
0 answers

Correct usage of the RIP related addressing

I found example of code on assembly, which finds the maximum number in array named data_items but that example was for x86 and I tried to adapt it for x64 because 32 bit absolute addressing is not supported by 64 bit system. To be short there are…
Arsynth
  • 761
  • 9
  • 22
1
vote
1 answer

Pointer to the text segment from the data segment

Is it possible to do the following with this relative addressing in x86-64? section .text two dq 0 section .data one: dq two When I do it this way on OS X with nasm, I get the following linker warning: ld: warning: PIE disabled. Absolute…
Matt Fichman
  • 5,458
  • 4
  • 39
  • 59
1
vote
0 answers

Why can `%rip + displacement` access data section?

The usage of this is that I saw after used gcc -S. I know ary represents the first address of the sequence, then I also know leaq ary(, %rdi, 4) has the same effect(assume %rdi equals 0). But I don't understand, why can ary(%rip) access data…
1
vote
2 answers

Force RIP-relative access to fixed offset in NASM

For a binary instrumentation project I wrote a chunk of assembly code in NASM, which gets mapped into a binary's address space at runtime. The chunk gets loaded at address instrument_addr, and needs to access data at address…
janw
  • 8,758
  • 11
  • 40
  • 62
1
vote
1 answer

lea assembly instruction syntax

Hi I am new to assembly language and I am getting confused about the syntax of lea instruction I have seen when I study a piece of code ( which is generated by using gdb command : disassemble main ). lea 0xa8e96(%rip),%rsi # 0x4aa5df The…
1
vote
2 answers

PyCUDA Memory Addressing: Memory offset?

I've got a large chunk of generated data (A[i,j,k]) on the device, but I only need one 'slice' of A[i,:,:], and in regular CUDA this could be easily accomplished with some pointer arithmetic. Can the same thing be done within pycuda? i.e…
Bolster
  • 7,460
  • 13
  • 61
  • 96
1
vote
3 answers

Compiler-generated relative addresses and how they are represented in (preferably java) bytecode?

When address binding is not possible at compile time, it's done at load/link or runtime, to associate relative ( or perhaps we can call them relocatable addresses ) addresses with actual physical ones. Plus, the CPU also converts those relative…
1
vote
2 answers

Addressing data using relative pointers (x86-32 assembler)

I'm writing in 32-bit x86 assembler, and I'm not quite sure how to address data that is always in the same relation to the code. Do I have to use EIP to calculate the absolute address, or is there a better way?
Neo_b
  • 231
  • 5
  • 9
1
vote
1 answer

ARM instruction to hex for loads like pc-relative LDR

I've been trying to translate the arm instruction to hex which include PC register, for example ldr rx, [pc, #xx] I have checked the "ARM Architecture Reference Manual", and the description of LDR instruction is as below: Questions appeared, …
1
vote
1 answer

How do two-pass assemblers deal with instructions that are expanded by the assembler?

Consider the following MIPS assembly (I'm using MIPS because that is what my Computer Organization and Design book uses): beq $s0, $s1, L1 add $t0, $t1, $t2 ... L1: ... Because MIPS only uses 16 bits for the PC-relative address in the beq…
Matthew
  • 28,056
  • 26
  • 104
  • 170