blob: 4c5ffc5b4ecfbd1a7d8bb941eb04061906cb879c [file] [log] [blame]
buzbee1452bee2015-03-06 14:43:04 -08001/*
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 * Interpreter entry point.
18 */
19
20 .text
21 .align 2
22 .global ExecuteMterpImpl
23 .type ExecuteMterpImpl, %function
24
25/*
26 * On entry:
27 * r0 Thread* self/
28 * r1 code_item
29 * r2 ShadowFrame
30 * r3 JValue* result_register
31 *
32 */
33
34ExecuteMterpImpl:
35 .fnstart
36 .save {r4-r10,fp,lr}
37 stmfd sp!, {r4-r10,fp,lr} @ save 9 regs
38 .pad #4
39 sub sp, sp, #4 @ align 64
40
41 /* Remember the return register */
42 str r3, [r2, #SHADOWFRAME_RESULT_REGISTER_OFFSET]
43
44 /* Remember the code_item */
45 str r1, [r2, #SHADOWFRAME_CODE_ITEM_OFFSET]
46
47 /* set up "named" registers */
48 mov rSELF, r0
49 ldr r0, [r2, #SHADOWFRAME_NUMBER_OF_VREGS_OFFSET]
50 add rFP, r2, #SHADOWFRAME_VREGS_OFFSET @ point to insns[] (i.e. - the dalivk byte code).
51 add rREFS, rFP, r0, lsl #2 @ point to reference array in shadow frame
52 ldr r0, [r2, #SHADOWFRAME_DEX_PC_OFFSET] @ Get starting dex_pc.
53 add rPC, r1, #CODEITEM_INSNS_OFFSET @ Point to base of insns[]
54 add rPC, rPC, r0, lsl #1 @ Create direct pointer to 1st dex opcode
55 EXPORT_PC
56
57 /* Starting ibase */
58 ldr rIBASE, [rSELF, #THREAD_CURRENT_IBASE_OFFSET]
59
60 /* start executing the instruction at rPC */
61 FETCH_INST @ load rINST from rPC
62 GET_INST_OPCODE ip @ extract opcode from rINST
63 GOTO_OPCODE ip @ jump to next instruction
64 /* NOTE: no fallthrough */