blob: 229ac9755f48f83521b945a15b94de98f5b1f18e [file] [log] [blame]
Serban Constantinescue6622be2014-02-27 15:36:47 +00001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "disassembler_arm64.h"
18
19#include <inttypes.h>
20
Ian Rogerscf7f1912014-10-22 22:06:39 -070021#include <ostream>
Serban Constantinescue6622be2014-02-27 15:36:47 +000022
23#include "base/logging.h"
24#include "base/stringprintf.h"
25#include "thread.h"
26
27namespace art {
28namespace arm64 {
29
Serban Constantinescue6622be2014-02-27 15:36:47 +000030size_t DisassemblerArm64::Dump(std::ostream& os, const uint8_t* begin) {
Alexandre Ramesfef019c2014-10-10 17:14:18 +010031 const vixl::Instruction* instr = reinterpret_cast<const vixl::Instruction*>(begin);
32 decoder.Decode(instr);
Brian Carlstrom2cbaccb2014-09-14 20:34:17 -070033 os << FormatInstructionPointer(begin)
Alexandre Ramesfef019c2014-10-10 17:14:18 +010034 << StringPrintf(": %08x\t%s\n", instr->InstructionBits(), disasm.GetOutput());
Serban Constantinescue6622be2014-02-27 15:36:47 +000035 return vixl::kInstructionSize;
36}
37
38void DisassemblerArm64::Dump(std::ostream& os, const uint8_t* begin, const uint8_t* end) {
39 for (const uint8_t* cur = begin; cur < end; cur += vixl::kInstructionSize) {
40 Dump(os, cur);
41 }
42}
43
44} // namespace arm64
45} // namespace art