Dave Allison | f9487c0 | 2014-04-08 23:08:12 +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 "driver/compiler_driver.h" |
| 18 | |
| 19 | namespace art { |
| 20 | void CompilerDriver::BuildArmEntrypointTrampolineCall(ThreadOffset<4> thread_offset) { |
| 21 | // Thumb2 instruction encoding of: |
| 22 | // ldr pc,[r9,#offset] |
| 23 | |
| 24 | // TODO: we don't currently have a Thumb2 assembler, when we do use that |
| 25 | // in preference to the hand generated code below. |
| 26 | uint32_t offset = thread_offset.Uint32Value(); |
| 27 | uint32_t instruction = 0xf8d0f000 | (9 << 16) | (offset & 0xfff); |
| 28 | entrypoint_trampoline_code_.push_back((instruction >> 16) & 0xff); |
| 29 | entrypoint_trampoline_code_.push_back((instruction >> 24) & 0xff); |
| 30 | entrypoint_trampoline_code_.push_back((instruction >> 0) & 0xff); |
| 31 | entrypoint_trampoline_code_.push_back((instruction >> 8) & 0xff); |
| 32 | } |
| 33 | } // namespace art |