1/* 2 * Copyright (C) 2016 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/* 18 * Interpreter entry point. 19 */ 20 21 .set reorder 22 23 .text 24 .global ExecuteMterpImpl 25 .type ExecuteMterpImpl, %function 26 .balign 16 27/* 28 * On entry: 29 * a0 Thread* self 30 * a1 code_item 31 * a2 ShadowFrame 32 * a3 JValue* result_register 33 * 34 */ 35ExecuteMterpImpl: 36 .cfi_startproc 37 .cpsetup t9, t8, ExecuteMterpImpl 38 39 .cfi_def_cfa sp, 0 40 daddu sp, sp, -STACK_SIZE 41 .cfi_adjust_cfa_offset STACK_SIZE 42 43 sd t8, STACK_OFFSET_GP(sp) 44 .cfi_rel_offset 28, STACK_OFFSET_GP 45 sd ra, STACK_OFFSET_RA(sp) 46 .cfi_rel_offset 31, STACK_OFFSET_RA 47 48 sd s0, STACK_OFFSET_S0(sp) 49 .cfi_rel_offset 16, STACK_OFFSET_S0 50 sd s1, STACK_OFFSET_S1(sp) 51 .cfi_rel_offset 17, STACK_OFFSET_S1 52 sd s2, STACK_OFFSET_S2(sp) 53 .cfi_rel_offset 18, STACK_OFFSET_S2 54 sd s3, STACK_OFFSET_S3(sp) 55 .cfi_rel_offset 19, STACK_OFFSET_S3 56 sd s4, STACK_OFFSET_S4(sp) 57 .cfi_rel_offset 20, STACK_OFFSET_S4 58 sd s5, STACK_OFFSET_S5(sp) 59 .cfi_rel_offset 21, STACK_OFFSET_S5 60 61 /* Remember the return register */ 62 sd a3, SHADOWFRAME_RESULT_REGISTER_OFFSET(a2) 63 64 /* Remember the code_item */ 65 sd a1, SHADOWFRAME_CODE_ITEM_OFFSET(a2) 66 67 /* set up "named" registers */ 68 move rSELF, a0 69 daddu rFP, a2, SHADOWFRAME_VREGS_OFFSET 70 lw v0, SHADOWFRAME_NUMBER_OF_VREGS_OFFSET(a2) 71 dlsa rREFS, v0, rFP, 2 72 daddu rPC, a1, CODEITEM_INSNS_OFFSET 73 lw v0, SHADOWFRAME_DEX_PC_OFFSET(a2) 74 dlsa rPC, v0, rPC, 1 75 EXPORT_PC 76 77 /* Starting ibase */ 78 REFRESH_IBASE 79 80 /* start executing the instruction at rPC */ 81 FETCH_INST 82 GET_INST_OPCODE v0 83 GOTO_OPCODE v0 84 85 /* NOTE: no fallthrough */ 86