什么是_emit在Linux上的等效? [英] What is the equivalent of _emit on Linux?
问题描述
我试图写端口在Visual Studio中为GNU内联汇编Linux上的一些汇编code。原来的code使用 _emit 其MSDN描述作为伪指令,并解释为:
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:
该_emit pseudoinstruction类似MASM的DB指令。您可以使用_emit在当前文本段的当前位置,以确定一个单一的即时字节。然而,_emit可以一次只定义一个字节,它只能限定在文本段中的字节。它使用相同的语法INT指令。
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.
我如何能做到在Linux同样的事情?
How can I do the same thing on Linux?
推荐答案
要发出字节0×12(例如),这样做:
To emit byte 0x12 (for example), do:
asm __volatile__ (".byte 0x12");
虽然,你可能会得到与优化,令人惊讶的结果启用。
Although, you might get surprising results with optimizations enabled.
这篇关于什么是_emit在Linux上的等效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!