Re: newbie questiom about %rip in x86-64 and var




Claudio Daffra wrote:
thx robert .

4004b0: c6 05 49 07 10 00 01 movb $0x1,1050441(%rip)
# 500c00 <uc>
4004b7: c6 05 42 07 10 00 01 movb $0x1,1050434(%rip)
# 500c00 <uc>

ok the offset change always.

the var is in virtual address 500c00 and rip is 4004b0 but
difficult i have mean the offset number
0x0105:0441
0x0105:0434

0x0050:0c00 -
0x0040:04b0 =
-------------------
0x0010:0750
distance from RIP and Virtual address refer memory?
not 0x0105:0441 or 0x0105:0434 .


First, don't write flat addresses in segmented (xxxx:yyyy) form, you'll
just confuse everyone.

Second, the offset in the source instruction "movb
$0x1,1050441(%rip)" is in *decimal*. So it's actually rip+0x100749 (or
0x100742 for the second instruction). And don't forget that rip is
assumed to point at the beginning of the the *next* instruction.

.



Relevant Pages

  • Re: Code density and performance?
    ... > I figured that narrow format would have about 47 inst using 42 opcodes ... You also need load/store with SP as a base and a large offset. ... Having 16-bit compare/branch is a key part of a dense instruction set. ... avoid 5 decode possibilities of the 10 cases, ...
    (comp.arch)
  • Re: [PATCH] [3/4] x86: MCE: Improve mce_get_rip
    ... I would prefer to pt in RIP in both cases, ... I also supposed it will be an issue on parsers. ... improvement and MSR definition, ... The mce_get_ripis a function to get the address of instruction ...
    (Linux-Kernel)
  • Re: writing a monitor
    ... Now I'm checking my work by comparing my disassembly carefully ... instruction is E8 D8 FF which is call 0xFFD8 and corresponds to ... which adds 2 to the offset, ... so here we seem to be using 2's complements instead of 1's complements. ...
    (comp.lang.asm.x86)
  • Re: writing a monitor
    ... Now I'm checking my work by comparing my disassembly carefully ... So it's only the instruction length what you need to add in addition. ... A negative offset does not mean a backward reference in all cases. ... so here we seem to be using 2's complements instead of 1's ...
    (comp.lang.asm.x86)
  • Re: Thanks : Re: How to get Code Segment Base Address in PM
    ... You will get the offset of the instruction directly _after_ the call. ... is the offset where the program returns after a ret instruction. ... You have to compute all offsets relative to the instruction after the geteip ...
    (comp.lang.asm.x86)