op for an instruction?
In an assembly language, how can I use pseudo-ops for an instruction? From what I know, an assembly file is converted to machine code using an assembler. Is there a way to directly send the op-code from the assembly file itself using pseudo-ops?
For example if there's some instruction, say ADD which has an op-code of 0101. Is there a way to use our that knowledge of ADD's op code being 0101 to just ADD two registers using 0101 from some memory location and not using the ADD instruction explicitly? I was looking for a hack and was wondering this.
Using an indirect opcode (retrieve the instruction byte from a data location specified in the instruction) is not supported in any machine language I know. But you have the following possibilities:
You haven't specified what assembler you're using, but GAS for example has the .byte
pseudo-op to simply emit a byte. Note that 0101 is in binary notation which is probably not suitable for the assembler. You should specify opcodes in hexadecimal.
Yes, this is possible, and is in fact how buffer overflow or stack overrun exploits work to attack system security. If binary values are stored into executable memory, they will be loaded and executed as machine language instructions, and 0101 will ADD (in your example).
链接地址: http://www.djcxy.com/p/87134.html上一篇: 大会,没有这样的指令弹出?
下一篇: 操作指令?