Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> There's a bit of a miscommunication going on. What I meant was, when you write an assembly instruction, that maps to one machine instruction.

That's not true on x86-16, x86-32 and x86-64. For example

  060o, 310o
and

  062o, 301o
(...o means "octal"; for the reason why I give this example in octal instead of hexadecimal cf. https://news.ycombinator.com/item?id=13051770) both stand for "xor al, cl" (the assembler you use will one of the two encodings) - for those people who really prefer hexadecimal here: It corresponds to

  30h, C8h
and

  32h, C1h
The fact that there are different ways to encode some instructions was used by the A86 assembler (https://en.wikipedia.org/w/index.php?title=A86_(software)&ol...) to watermark machine code that was generated by it; in particular to detect whether it was generated by a registered or unregistered version of A86:

"The assembler automatically embeds a "fingerprint" into the generated code through a particular choice of functionally equivalent instruction encodings. This makes it possible to tell if code was assembled with A86, and also to distinguish between registered and unregistered versions of the assembler, although access to the source code is required."



Re-read my previous comment. An assembly instruction can map to one of a set of machine instructions, but only one.

Said another way, when you write:

MOV eax, 5

This will map to _either_:

110111 _or_ 110110, but _not_ both in sequence.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: