can I depict opcodes in inline assembly? (GNU or OSX)

186 Views Asked by At

I have to translate windows assembly with __emit directive & opcode and transform it as OSX assembly. The original code look like,

__asm { 
test:
       __emit 0x0008
.
.
.
}

(0x0008 means nothing, just example)

I'm wondering, is there any equivalent directive in gnu or osx compiler(llvm) with __emit directive which is execute opcode directly.

any advice is welcome. thanks

1

There are 1 best solutions below

0
On

The GCC equivalent of __emit is:

.long 0xXXXXXXXX
.short 0xXXXX
.byte 0xXX

depending on the size (32, 16 or 8 bits) of the data inserted.