blob: b83f7e1d83b39b266ec8f6e49c00471cdcd39cc0 [file] [log] [blame]
Bill Buzbee7c58bd42016-01-20 20:46:01 +00001/*
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
Serguei Katkov05dfaaa2016-01-28 08:21:26 +060021 .global SYMBOL(ExecuteMterpImpl)
22 FUNCTION_TYPE(ExecuteMterpImpl)
Bill Buzbee7c58bd42016-01-20 20:46:01 +000023
24/*
25 * On entry:
26 * 0 Thread* self
27 * 1 code_item
28 * 2 ShadowFrame
29 * 3 JValue* result_register
30 *
31 */
32
Serguei Katkov05dfaaa2016-01-28 08:21:26 +060033SYMBOL(ExecuteMterpImpl):
Bill Buzbee7c58bd42016-01-20 20:46:01 +000034 .cfi_startproc
35 /* Allocate frame */
36 subl $$FRAME_SIZE, %esp
37 .cfi_adjust_cfa_offset FRAME_SIZE
38
39 /* Spill callee save regs */
40 movl %ebp, EBP_SPILL(%esp)
41 movl %edi, EDI_SPILL(%esp)
42 movl %esi, ESI_SPILL(%esp)
43 movl %ebx, EBX_SPILL(%esp)
44
45 /* Load ShadowFrame pointer */
46 movl IN_ARG2(%esp), %edx
47
48 /* Remember the return register */
49 movl IN_ARG3(%esp), %eax
50 movl %eax, SHADOWFRAME_RESULT_REGISTER_OFFSET(%edx)
51
52 /* Remember the code_item */
53 movl IN_ARG1(%esp), %ecx
54 movl %ecx, SHADOWFRAME_CODE_ITEM_OFFSET(%edx)
55
56 /* set up "named" registers */
57 movl SHADOWFRAME_NUMBER_OF_VREGS_OFFSET(%edx), %eax
58 leal SHADOWFRAME_VREGS_OFFSET(%edx), rFP
59 leal (rFP, %eax, 4), rREFS
60 movl SHADOWFRAME_DEX_PC_OFFSET(%edx), %eax
61 lea CODEITEM_INSNS_OFFSET(%ecx), rPC
62 lea (rPC, %eax, 2), rPC
63 EXPORT_PC
64
65 /* Starting ibase */
66 REFRESH_IBASE
67
68 /* start executing the instruction at rPC */
69 FETCH_INST
70 GOTO_NEXT
71 /* NOTE: no fallthrough */