Serban Constantinescu | e6622be | 2014-02-27 15:36:47 +0000 | [diff] [blame] | 1 | /* |
| 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 Rogers | cf7f191 | 2014-10-22 22:06:39 -0700 | [diff] [blame] | 21 | #include <ostream> |
Serban Constantinescu | e6622be | 2014-02-27 15:36:47 +0000 | [diff] [blame] | 22 | |
| 23 | #include "base/logging.h" |
| 24 | #include "base/stringprintf.h" |
| 25 | #include "thread.h" |
| 26 | |
| 27 | namespace art { |
| 28 | namespace arm64 { |
| 29 | |
Serban Constantinescu | e6622be | 2014-02-27 15:36:47 +0000 | [diff] [blame] | 30 | size_t DisassemblerArm64::Dump(std::ostream& os, const uint8_t* begin) { |
Alexandre Rames | fef019c | 2014-10-10 17:14:18 +0100 | [diff] [blame] | 31 | const vixl::Instruction* instr = reinterpret_cast<const vixl::Instruction*>(begin); |
| 32 | decoder.Decode(instr); |
Brian Carlstrom | 2cbaccb | 2014-09-14 20:34:17 -0700 | [diff] [blame] | 33 | os << FormatInstructionPointer(begin) |
Alexandre Rames | fef019c | 2014-10-10 17:14:18 +0100 | [diff] [blame] | 34 | << StringPrintf(": %08x\t%s\n", instr->InstructionBits(), disasm.GetOutput()); |
Serban Constantinescu | e6622be | 2014-02-27 15:36:47 +0000 | [diff] [blame] | 35 | return vixl::kInstructionSize; |
| 36 | } |
| 37 | |
| 38 | void 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 |