flat assembler
Message board for the users of flat assembler.
Index
> Main > i dont understand this..(the $ symbol) |
Author |
|
badc0de02 01 May 2014, 19:46
$=current offset
jmp $ is the same as (loop forever) x: jmp x |
|||
01 May 2014, 19:46 |
|
revolution 02 May 2014, 02:25
You can think of $ as always equalling {E|R}IP.
|
|||
02 May 2014, 02:25 |
|
Bargest 02 May 2014, 14:58
revolution wrote: You can think of $ as always equalling {E|R}IP. Not EIP, but EIP minus size of current command. Because Code: jmp $ is equal to Code: label: jmp label But at this point EIP is equal to address of the next command. And this code will compile as 0xEB 0xFE, which means "jump -2". _________________ jmp $ ; Happy end! |
|||
02 May 2014, 14:58 |
|
revolution 02 May 2014, 15:35
Sure. But that is merely an implementation issue of the x86. Other CPUs can do different things. At the assembly level $ is the same as IP in the logical sense of being the address of the current instruction.
|
|||
02 May 2014, 15:35 |
|
shutdownall 03 May 2014, 17:00
revolution wrote: You can think of $ as always equalling {E|R}IP. Well - depends on type of segment. If you create a data segment (no execute) it wouldn't be suitable to compare it with the actual position of IP. Or when using segmented addresses in real mode. |
|||
03 May 2014, 17:00 |
|
badc0de02 04 May 2014, 08:24
$=current offset
$$=offset from the begin of you code Code: org 0x7c00 boot: jmp boot ; loop times 512-($-$$) db 0 ; times 512-((0x7c00+2)-0x7c00) |
|||
04 May 2014, 08:24 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.