Home | History | Annotate | Download | only in mips
      1 
      2 /*
      3  * Copyright (C) 2008 The Android Open Source Project
      4  *
      5  * Licensed under the Apache License, Version 2.0 (the "License");
      6  * you may not use this file except in compliance with the License.
      7  * You may obtain a copy of the License at
      8  *
      9  *      http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 /*
     18  * Interpreter entry point.
     19  */
     20 
     21 #define ASSIST_DEBUGGER 1
     22 
     23     .text
     24     .align 2
     25     .global dvmMterpStdRun
     26     .ent dvmMterpStdRun
     27     .frame sp, STACK_SIZE, ra
     28 /*
     29  * On entry:
     30  *  r0  Thread* self
     31  *
     32  * The return comes via a call to dvmMterpStdBail().
     33  */
     34 
     35 dvmMterpStdRun:
     36     .set noreorder
     37     .cpload t9
     38     .set reorder
     39 /* Save to the stack. Frame size = STACK_SIZE */
     40     STACK_STORE_FULL()
     41 /* This directive will make sure all subsequent jal restore gp at a known offset */
     42     .cprestore STACK_OFFSET_GP
     43 
     44     addu      fp, sp, STACK_SIZE           #  Move Frame Pointer to the base of frame
     45     /* save stack pointer, add magic word for debuggerd */
     46     sw        sp, offThread_bailPtr(a0)      # Save SP
     47 
     48     /* set up "named" registers, figure out entry point */
     49     move      rSELF, a0                    #  set rSELF
     50     LOAD_PC_FROM_SELF()
     51     LOAD_FP_FROM_SELF()
     52     lw        rIBASE, offThread_curHandlerTable(rSELF)
     53 
     54 #if defined(WITH_JIT)
     55 .LentryInstr:
     56     /* Entry is always a possible trace start */
     57     lw        a0, offThread_pJitProfTable(rSELF)
     58     FETCH_INST()                           #  load rINST from rPC
     59     sw        zero, offThread_inJitCodeCache(rSELF)
     60 #if !defined(WITH_SELF_VERIFICATION)
     61     bnez      a0, common_updateProfile     # profiling is enabled
     62 #else
     63     lw       a2, offThread_shadowSpace(rSELF) # to find out the jit exit state
     64     beqz     a0, 1f                        # profiling is disabled
     65     lw       a3, offShadowSpace_jitExitState(a2) # jit exit state
     66     li	     t0, kSVSTraceSelect
     67     bne      a3, t0, 2f
     68     li       a2, kJitTSelectRequestHot     # ask for trace selection
     69     b        common_selectTrace            # go build the trace
     70 2:
     71     li       a4, kSVSNoProfile
     72     beq      a3, a4, 1f                    # don't profile the next instruction?
     73     b        common_updateProfile          # collect profiles
     74 #endif
     75 1:
     76     GET_INST_OPCODE(t0)                    #  extract opcode from rINST
     77     GOTO_OPCODE(t0)                        #  jump to next instruction
     78 #else
     79     /* start executing the instruction at rPC */
     80     FETCH_INST()                           #  load rINST from rPC
     81     GET_INST_OPCODE(t0)                    #  extract opcode from rINST
     82     GOTO_OPCODE(t0)                        #  jump to next instruction
     83 #endif
     84 
     85 .Lbad_arg:
     86     la        a0, .LstrBadEntryPoint
     87     #a1 holds value of entryPoint
     88     JAL(printf)
     89     JAL(dvmAbort)
     90 
     91     .end dvmMterpStdRun
     92 
     93     .global dvmMterpStdBail
     94     .ent dvmMterpStdBail
     95 
     96 /* Restore the stack pointer and all the registers stored at sp from the save
     97  * point established  on entry. Return to whoever called dvmMterpStdRun.
     98  *
     99  * On entry:
    100  *   a0    Thread* self
    101  */
    102 dvmMterpStdBail:
    103     lw        sp, offThread_bailPtr(a0)      #  Restore sp
    104     STACK_LOAD_FULL()
    105     jr        ra
    106 
    107     .end dvmMterpStdBail
    108