2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | (c) Copyright IBM Corporation 2015-2016 |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #include "hphp/ppc64-asm/dasm-ppc64.h"
19 #include <folly/Format.h>
21 #include "hphp/ppc64-asm/asm-ppc64.h"
22 #include "hphp/ppc64-asm/decoder-ppc64.h"
26 void Disassembler::disassembly(std::ostream
& out
,
27 const uint8_t* const instr
,
28 const uint8_t* const address
) {
29 if (!color_
.empty()) {
33 for (int i
=0; i
< indent_level_
; i
++) {
38 uint32_t instruction
= 0;
40 for (pos
= 0; pos
< instr_size_in_bytes
; ++pos
) {
41 // TODO(rcardoso): only print encoding if told so.
42 out
<< folly::format("{:02x} ", (uint8_t)instr
[pos
]);
43 instruction
|= ((uint8_t)instr
[pos
]) << (8 * pos
);
46 // Decode instruction and get mnemonic representation
47 DecoderInfo dec_info
= Decoder::GetDecoder().decode(instr
);
48 if (address
) dec_info
.setIp(address
);
49 out
<< dec_info
.toString();
53 } // namespace ppc64_asm