1 /* 2 * Copyright (C) 2008 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 .text 19 .global dvmMterpStdRun 20 .type dvmMterpStdRun, %function 21 /* 22 * bool dvmMterpStdRun(Thread* self) 23 * 24 * Interpreter entry point. Returns changeInterp. 25 * 26 */ 27 dvmMterpStdRun: 28 push %ebp # save caller base pointer 29 movl %esp, %ebp # set our %ebp 30 movl rSELF, %ecx # get incoming rSELF 31 /* 32 * At this point we've allocated one slot on the stack 33 * via push and stack is 8-byte aligned. Allocate space 34 * for 9 spill slots, 4 local slots, 5 arg slots to bring 35 * us to 16-byte alignment 36 */ 37 subl $$(FRAME_SIZE-4), %esp 38 39 /* Spill callee save regs */ 40 movl %edi,EDI_SPILL(%ebp) 41 movl %esi,ESI_SPILL(%ebp) 42 movl %ebx,EBX_SPILL(%ebp) 43 44 /* Set up "named" registers */ 45 movl offThread_pc(%ecx),rPC 46 movl offThread_curFrame(%ecx),rFP 47 movl offThread_curHandlerTable(%ecx),rIBASE 48 49 /* Remember %esp for future "longjmp" */ 50 movl %esp,offThread_bailPtr(%ecx) 51 52 /* Normal case: start executing the instruction at rPC */ 53 FETCH_INST 54 GOTO_NEXT 55 56 .global dvmMterpStdBail 57 .type dvmMterpStdBail, %function 58 /* 59 * void dvmMterpStdBail(Thread* self, bool changeInterp) 60 * 61 * Restore the stack pointer and PC from the save point established on entry. 62 * This is essentially the same as a longjmp, but should be cheaper. The 63 * last instruction causes us to return to whoever called dvmMterpStdRun. 64 * 65 * We're not going to build a standard frame here, so the arg accesses will 66 * look a little strange. 67 * 68 * On entry: 69 * esp+4 (arg0) Thread* self 70 * esp+8 (arg1) bool changeInterp 71 */ 72 dvmMterpStdBail: 73 movl 4(%esp),%ecx # grab self 74 movl 8(%esp),%eax # changeInterp to return reg 75 movl offThread_bailPtr(%ecx),%esp # Restore "setjmp" esp 76 movl %esp,%ebp 77 addl $$(FRAME_SIZE-4), %ebp # Restore %ebp at point of setjmp 78 movl EDI_SPILL(%ebp),%edi 79 movl ESI_SPILL(%ebp),%esi 80 movl EBX_SPILL(%ebp),%ebx 81 movl %ebp, %esp # strip frame 82 pop %ebp # restore caller's ebp 83 ret # return to dvmMterpStdRun's caller 84 85 86 /* 87 * Strings 88 */ 89 .section .rodata 90 .LstrBadEntryPoint: 91 .asciz "Bad entry point %d\n" 92 93