opcode

Get size of assembly instructions

青春壹個敷衍的年華 提交于 2019-11-27 14:30:23
I need to read instructions one-by-one from a small code segment in memory and I have to find out the size of the instructions which I have in memory. The following is just a example of raw disassembled code to explain my problem: (gdb) disas /r 0x400281,+8 Dump of assembler code from 0x400281 to 0x400289: 0x0000000000400281: 48 89 c7 movq %rax, %rdi 0x0000000000400284: b0 00 movb $0, %al 0x0000000000400286: e8 f2 48 00 00 callq 0x10001f30a End of assembler dump. I know the memory address of the first instruction (p = 0x0000000000400281 in this case) and I can read every memory address from p.

What are the semantics of ADRP and ADRL instructions in ARM assembly?

眉间皱痕 提交于 2019-11-27 13:16:04
问题 ADRP Address of 4KB page at a PC-relative offset. ADRL Load a PC-relative address into a register. It is similar to the ADR instruction. ADRL can load a wider range of addresses than ADR because it generates two data processing instructions. Specifically, ADRL assembles to two instructions, an ADRP followed by ADD. If the assembler cannot construct the address in two instructions, it generates a relocation. The linker then generates the correct offsets. ADRL produces position-independent code

execute binary machine code from C

删除回忆录丶 提交于 2019-11-27 07:08:10
following this instructions I have managed to produce only 528 bytes in size a.out (when gcc main.c gave me 8539 bytes big file initially). main.c was: int main(int argc, char** argv) { return 42; } but I have built a.out from this assembly file instead: main.s: ; tiny.asm BITS 64 GLOBAL _start SECTION .text _start: mov eax, 1 mov ebx, 42 int 0x80 with: me@comp# nasm -f elf64 tiny.s me@comp# gcc -Wall -s -nostartfiles -nostdlib tiny.o me@comp# ./a.out ; echo $? 42 me@comp# wc -c a.out 528 a.out because I need machine code I do: objdump -d a.out a.out: file format elf64-x86-64 Disassembly of

Translation of machinecode into LLVM IR (disassembly / reassembly of X86_64. X86. ARM into LLVM bitcode)

感情迁移 提交于 2019-11-27 06:16:42
I would like to translate X86_64, x86, ARM executables into LLVM IR (disassembly). What solution do you suggest ? mcsema is a production-quality binary lifter. It takes x86 and x86-64 and statically "lifts" it to LLVM IR. It's actively maintained, BSD licensed, and has extensive tests and documentation. https://github.com/trailofbits/mcsema Consider using RevGen tool developed within the S2E project . It allows converting x86 binaries to LLVM IR. The source code could be checked out from Revgen branch of GIT repository available by url https://dslabgit.epfl.ch/git/s2e/s2e.git . As regards to

Avoiding getfield opcode

浪子不回头ぞ 提交于 2019-11-27 04:57:52
In Java's String class, the trim method contains this: int off = offset; /* avoid getfield opcode */ char[] val = value; /* avoid getfield opcode */ I'm a bit puzzled by the comment "avoid getfield opcode" ... What does this mean? (I take it this avoids the use of getfield in the bytecode but why is this a Good Thing [TM]?) Is it to prevent object creation in case trim doesn't do anything (and hence this is returned) or? My guess is that the point is to copy the values into local variables once, to avoid having to fetch the field value repeatedly from the heap for each iteration of the loop in

Non-invocable member '' cannot be used like a method

旧街凉风 提交于 2019-11-27 04:53:29
问题 I'm facing a problem right naw. So i'll put the code right away; public static List<ushort> blockedOpcodes = new List<ushort>(); public static bool isOpcodeAllowed(ushort opcode) { lock (locker) { if (blockedOpcodes.Contains(opcode)) { Log1.LogMsg("Oops! Someone tried to send a blocked packet: 0x{" + opcode + ":X}"); return false; } return true; } } public static void Load() { lock (locker) { StreamReader reader; using (reader = new StreamReader("filter.txt")) { string str = null; while ((str

How to get opcodes of PHP?

半世苍凉 提交于 2019-11-27 04:10:53
问题 <?php $show_value = 123; echo 'sing_quote'.$show_value; echo "double_quote{$show_value}"; ?> Its opcode is: 1: <?php 2: $show_value = 123; 0 ASSIGN !0, 123 3: echo 'sing_quote'.$show_value; 1 CONCAT 'sing_quote', !0 =>RES[~1] 2 ECHO ~1 4: echo "double_quote{$show_value}"; 3 ADD_STRING 'double_quote' =>RES[~2] 4 ADD_VAR ~2, !0 =>RES[~2] 5 ECHO ~2 6 RETURN 1 回答1: Check out the Vulcan Logic Disassembler PECL extension - see author's home page for more info. The Vulcan Logic Disassembler hooks

How to read the Intel Opcode notation

懵懂的女人 提交于 2019-11-27 01:58:47
问题 I am reading some material about Intel Opcodes of assembly instructions, but I cannot understand what does it mean that follows the opcode byte. For example: "cw", "cd", "/2", "cp", "/3". Please give me a hint what does it mean or where can I find the complete reference ? Thanks in advance! E8 cw CALL rel16 Call near, relative, displacement relative to next instruction E8 cd CALL rel32 Call near, relative, displacement relative to next instruction FF /2 CALL r/m16 Call near, absolute indirect

Get size of assembly instructions

為{幸葍}努か 提交于 2019-11-26 16:46:46
问题 I need to read instructions one-by-one from a small code segment in memory and I have to find out the size of the instructions which I have in memory. The following is just a example of raw disassembled code to explain my problem: (gdb) disas /r 0x400281,+8 Dump of assembler code from 0x400281 to 0x400289: 0x0000000000400281: 48 89 c7 movq %rax, %rdi 0x0000000000400284: b0 00 movb $0, %al 0x0000000000400286: e8 f2 48 00 00 callq 0x10001f30a End of assembler dump. I know the memory address of

Translation of machinecode into LLVM IR (disassembly / reassembly of X86_64. X86. ARM into LLVM bitcode)

元气小坏坏 提交于 2019-11-26 11:57:03
问题 I would like to translate X86_64, x86, ARM executables into LLVM IR (disassembly). What solution do you suggest ? 回答1: mcsema is a production-quality binary lifter. It takes x86 and x86-64 and statically "lifts" it to LLVM IR. It's actively maintained, BSD licensed, and has extensive tests and documentation. https://github.com/trailofbits/mcsema 回答2: Consider using RevGen tool developed within the S2E project. It allows converting x86 binaries to LLVM IR. The source code could be checked out