I'm trying to port some assembly code written in Visual Studio into GNU inline assembly on Linux. The original code uses _emit which MSDN describes as a pseudo instruction and explains as:
The _emit pseudoinstruction is similar to the DB directive of MASM. You use _emit to define a single immediate byte at the current location in the current text segment. However, _emit can define only one byte at a time, and it can only define bytes in the text segment. It uses the same syntax as the INT instruction.
How can I do the same thing on Linux?
To emit byte 0x12 (for example), do:
asm __volatile__ (".byte 0x12");
Although, you might get surprising results with optimizations enabled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With