What does double dollar sign mean in x86 assembly (NASM)

家住魔仙堡 提交于 2020-01-21 12:04:12

问题


The expression is:

times 512-($-$$) db 0

I know what the dollar sign means but I don't know what it means when it's double.

What does the double dollar sign mean?


回答1:


When all else fails, Read The Fine Manual (section 3.5 "Expressions"):

NASM supports two special tokens in expressions, allowing calculations to involve the current assembly position: the $ and $$ tokens. $ evaluates to the assembly position at the beginning of the line containing the expression; so you can code an infinite loop using JMP $. $$ evaluates to the beginning of the current section; so you can tell how far into the section you are by using ($−$$).

So the example in your question is just padding the current section to a size of 512 with zeroes.



来源:https://stackoverflow.com/questions/46726434/what-does-double-dollar-sign-mean-in-x86-assembly-nasm

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!