0

There are 2 instructions, I don't have a question on the whole instruction, just a symbols found inside each of them. Also can anyone tell me the x86 equivalent of the 2.

First code snippet

add     x19, x19, EXT(ResetHandlerData)@pageoff

What does the @pageoff do? I'm assuming it does what it says, it adds a page offset, ex 10@5 would result in 15. But I'm not sure if I'm correct. Next is

ldr     x1, [x19, CPU_DATA_ENTRIES] 

The square brackets in particular. I read online and read that it is dereferencing the value inside the brackets, if this is the case what is the comma for? Is it an offset like in GNU Assembler? If so what is the difference between this and the @ from the first instruction.

avin
  • 13
  • 4
  • 2
    The `@` suffixes usually mean special relocation entries. `pageoff` is a keyword, not a number. See this [question](https://stackoverflow.com/q/38711058/547981). In GNU assembler `@pageoff` is likely written as `:lo12:`. See the [manual](https://sourceware.org/binutils/docs/as/AArch64_002dRelocations.html). As for the other, presumably `CPU_DATA_ENTRIES` is a macro defined earlier. Yes, that is likely a numeric or register offset. – Jester Jul 12 '21 at 23:19
  • 2
    That looks like ARM64, right? (As opposed to RISC-V which uses the same register names, or anything else). That looks like standard ARM64 syntax, which both GAS and clang use. – Peter Cordes Jul 13 '21 at 00:03
  • @PeterCordes yes this is ARM64, my bad I meant to say what the x86 equivalent is – avin Jul 13 '21 at 16:05
  • 1
    x86 ELF relocations don't support splitting addresses into hi and `:lo12:` parts because x86 (including x86-64) machine code doesn't need that: it uses rel32 or 32-bit absolute addresses. Presumably that `add x19,x19` was part of a sequence of instructions that can be just a single instruction in x86-64. – Peter Cordes Jul 13 '21 at 18:05

0 Answers0