@@ -14,9 +14,48 @@ build the bindings.
1414Install with PIP+Git via:
1515
1616``` bash
17- python3 -m pip install --user git+https://github.com/angr/pypcode
17+ python -m pip install --user git+https://github.com/angr/pypcode
1818```
1919
2020You can now invoke the ` pypcode ` module from command line to translate supported
2121machine code to P-code from command line. Run ` python -m pypcode --help ` for
2222usage information. See module source for examples of using pypcode as a library.
23+
24+ Example
25+ -------
26+
27+ ```
28+ $ python -m pypcode -b x86:LE:64:default test-x64.bin
29+ --------------------------------------------------------------------------------
30+ 00000000/2: XOR EAX,EAX
31+ --------------------------------------------------------------------------------
32+ 0: CF = 0x0
33+ 1: OF = 0x0
34+ 2: EAX = EAX ^ EAX
35+ 3: RAX = zext(EAX)
36+ 4: SF = EAX s< 0x0
37+ 5: ZF = EAX == 0x0
38+ 6: unique[0x2580:4] = EAX & 0xff
39+ 7: unique[0x2590:1] = popcount(unique[0x2580:4])
40+ 8: unique[0x25a0:1] = unique[0x2590:1] & 0x1
41+ 9: PF = unique[0x25a0:1] == 0x0
42+
43+ --------------------------------------------------------------------------------
44+ 00000002/2: CMP ESI,EAX
45+ --------------------------------------------------------------------------------
46+ 0: CF = ESI < EAX
47+ 1: OF = sborrow(ESI, EAX)
48+ 2: unique[0x5180:4] = ESI - EAX
49+ 3: SF = unique[0x5180:4] s< 0x0
50+ 4: ZF = unique[0x5180:4] == 0x0
51+ 5: unique[0x2580:4] = unique[0x5180:4] & 0xff
52+ 6: unique[0x2590:1] = popcount(unique[0x2580:4])
53+ 7: unique[0x25a0:1] = unique[0x2590:1] & 0x1
54+ 8: PF = unique[0x25a0:1] == 0x0
55+
56+ --------------------------------------------------------------------------------
57+ 00000004/2: JBE 0x17
58+ --------------------------------------------------------------------------------
59+ 0: unique[0x18f0:1] = CF || ZF
60+ 1: if (unique[0x18f0:1]) goto ram[0x17:8]
61+ ```
0 commit comments