13102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI/*
23102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * Copyright (C) 2009 The Android Open Source Project
33102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI *
43102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * Licensed under the Apache License, Version 2.0 (the "License");
53102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * you may not use this file except in compliance with the License.
63102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * You may obtain a copy of the License at
73102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI *
83102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI *      http://www.apache.org/licenses/LICENSE-2.0
93102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI *
103102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * Unless required by applicable law or agreed to in writing, software
113102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * distributed under the License is distributed on an "AS IS" BASIS,
123102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
133102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * See the License for the specific language governing permissions and
143102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * limitations under the License.
153102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI */
163102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI/*
173102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * Invoking JNI native method via SH4 ABI.
183102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * This inplementation follows the spec found in following URL.
193102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * http://www.ecos.sourceware.org/docs-1.3.1/ref/gnupro-ref/sh/SH_ch01.html#pgfId-461254
203102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
213102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * This version supports SH4A little endian.
223102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI */
233102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    .text
243102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    .align 4
253102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    .type  dvmPlatformInvoke, #function
263102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    .globl dvmPlatformInvoke
273102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
283102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI/*
293102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * @param r4 void* pEnv  (used as scrach after invoking method)
303102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * @param r5 ClassObject* clazz
313102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * @param r6 int argInfo
323102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * @param r7 int argc
333102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * @param r15[0] const u4 * argv
343102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * @param r15[1] const char * shorty
353102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * @param r15[2] void * func
363102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * @param r15[3] JValue * pReturn
373102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI *
383102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * @remark r0,r1  Scratch before invoking method.
393102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI *                Return value after invoking method.
403102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * @remark r2  shorty pointer
413102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * @remark r3  argv pointer before invoking method.
423102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI *             pReturn after invoking method.
433102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * @remark r8-11 Don't touch.
443102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * @remark r12 status of r5-7
453102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * @remark r13 status of fr4-11
463102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI * @remark r14 Keep stack pointer.
473102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI */
483102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIdvmPlatformInvoke:
493102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ## save preserved regsiters
503102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   r14, @-r15
513102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     r15, r14
523102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    add     #4, r14             /* r14 = original r15 = stack pointer */
533102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   r13, @-r15
543102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   r12, @-r15
553102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    sts.l   pr, @-r15
563102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
573102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    # fetch arguments
583102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   @r14, r3            /* argv */
593102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   @(4,r14), r2        /* shorty for argumnets */
603102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #1, r0              /* shorty's 1st byte specify ret value type. */
613102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    add     r0, r2
623102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
633102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI### initialize local variables
643102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
653102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ## r12 ... status of r6, and r7
663102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ##          bit 1 << 0 : if r6 is available, it contains 1.
673102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ##          bit 1 << 1 : if r7 is available, it contains 1.
683102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ##  Note : r4 is always used to pass pEnv.
693102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ##         r5 is always used for clazz or object
703102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #3, r12             /* b0000-0111 : r5-7 avialble. */
713102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
723102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ## r13 ... status of fr4-fr11
733102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ##          bit 1 << 0 : if fr4 is available, it contains 1.
743102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ##          bit 1 << 1 : if fr5 is available, it contains 1.
753102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ##      ...
763102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ##          bit 1 << 7 : if fr11 is available, it contains 1.
773102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #0xFF, r13          /* b1111-1111 : fr4-11 avialble. */
783102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
793102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI### put arguments
803102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
813102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ## ... keep pEnv in r4 as is.
823102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
833102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ## check clazz
843102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #0, r0
853102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/eq  r0, r5
863102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bf      arg_loop            /* if r5 has clazz, keep it as is */
873102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   @r3+, r5            /* put object arg in r5 */
883102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
893102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ## other args
903102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIarg_loop:
913102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIone_arg_handled:
923102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.b   @r2+, r0
933102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/eq  #0, r0              /* if (*shorty == '\0) */
943102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bf      process_one_arg
953102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     arg_end             /* no argument left */
963102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
973102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
983102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIprocess_one_arg:
993102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
1003102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ## check arg type
1013102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
1023102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/eq  #'F', r0
1033102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      jfloat_arg
1043102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
1053102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/eq  #'D', r0
1063102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      jdouble_arg
1073102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
1083102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/eq  #'J', r0
1093102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      jlong_arg
1103102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
1113102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ## other 32bit arg types
1123102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     r12, r0
1133102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/eq  #0, r0
1143102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      put_32bit_on_stack  /* r6-7 not available */
1153102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
1163102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    tst     #1, r0
1173102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      j32_arg_1
1183102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   @r3+, r6            /* put one arg in r6 */
1193102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #1, r0              /* r6 is not available now. */
1203102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    not     r0, r0
1213102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     r0, r12
1223102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     one_arg_handled
1233102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
1243102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIj32_arg_1:
1253102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    tst     #2, r0
1263102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      j32_arg_fatal_error
1273102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   @r3+, r7            /* put one arg in r7 */
1283102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #2, r0              /* r7 is not available now. */
1293102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    not     r0, r0
1303102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     r0, r12
1313102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     one_arg_handled
1323102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
1333102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
1343102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIj32_arg_fatal_error:
1353102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     j32_arg_fatal_error
1363102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
1373102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
1383102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIjlong_arg:
1393102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     r12, r0
1403102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/eq  #0, r0
1413102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      put_64bit_on_stack  /* r6-7 not available */
1423102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
1433102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     #3, r0
1443102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/eq  #3, r0
1453102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bf      put_64bit_on_stack  /* consequent two registers not available. */
1463102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   @r3+, r6            /* put one arg in r6 and r7 */
1473102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   @r3+, r7
1483102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #3, r0              /* r6 and r7 are not available now. */
1493102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    not     r0, r0
1503102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     r0, r12
1513102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     one_arg_handled
1523102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
1533102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
1543102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    # utility routines are placed here make short range jumps available.
1553102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIput_32bit_on_stack:
1563102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   @r3+, r0
1573102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   r0, @-r15
1583102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     one_arg_handled
1593102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
1603102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
1613102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIput_64bit_on_stack:
1623102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   @r3+, r0
1633102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   r0, @-r15           /* Pay attention that the endianness is */
1643102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   @r3+, r0            /* once reversed.  It is corrected when the */
1653102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   r0, @-r15           /* arguments on stack are revesred before */
1663102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     one_arg_handled     /* jni call */
1673102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
1683102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
1693102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIjdouble_arg:
1703102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     r13, r0
1713102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/eq  #0, r0
1723102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      put_64bit_on_stack  /* fr4-11 not available */
1733102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
1743102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     #3, r0
1753102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/eq  #3, r0
1763102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bf      jdouble_arg_1
1773102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
1783102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  @r3+, fr5           /* put one arg to drX */
1793102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  @r3+, fr4
1803102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #3, r0              /* fr4-frX not available now. */
1813102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    not     r0, r0
1823102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     r0, r13
1833102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     one_arg_handled
1843102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
1853102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
1863102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIjdouble_arg_1:
1873102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     r13, r0
1883102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     #12, r0
1893102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/eq  #12, r0
1903102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bf      jdouble_arg_2
1913102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
1923102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  @r3+, fr7           /* put one arg to drX */
1933102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  @r3+, fr6
1943102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #15, r0             /* fr4-frX not available now. */
1953102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    not     r0, r0
1963102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     r0, r13
1973102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     one_arg_handled
1983102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
1993102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
2003102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIjdouble_arg_2:
2013102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     r13, r0
2023102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     #48, r0
2033102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/eq  #48, r0
2043102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bf      jdouble_arg_3
2053102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  @r3+, fr9           /* put one arg to drX */
2063102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  @r3+, fr8
2073102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #63, r0             /* fr4-frX not available now. */
2083102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    not     r0, r0
2093102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     r0, r13
2103102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     one_arg_handled
2113102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
2123102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
2133102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIjdouble_arg_3:
2143102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     r13, r0
2153102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     #192, r0
2163102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/eq  #192, r0
2173102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bf      put_64bit_on_stack
2183102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  @r3+, fr11          /* put one arg to drX */
2193102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  @r3+, fr10
2203102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #0, r13             /* fr4-fr11 all not available now. */
2213102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     one_arg_handled
2223102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
2233102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
2243102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIjfloat_arg:
2253102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     r13, r0
2263102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/eq  #0, r0
2273102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      put_32bit_on_stack  /* fr4-11 not available */
2283102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
2293102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    tst     #2, r0
2303102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      jfloat_arg_1
2313102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  @r3+, fr5           /* put one arg to frX */
2323102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #2, r0              /* frX not available now. */
2333102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    not     r0, r0
2343102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     r0, r13
2353102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     one_arg_handled
2363102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
2373102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
2383102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIjfloat_arg_1:
2393102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    tst     #1, r0
2403102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      jfloat_arg_2
2413102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  @r3+, fr4           /* put one arg to frX */
2423102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #1, r0              /* frX not available now. */
2433102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    not     r0, r0
2443102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     r0, r13
2453102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     one_arg_handled
2463102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
2473102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
2483102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIjfloat_arg_2:
2493102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    tst     #8, r0
2503102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      jfloat_arg_3
2513102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  @r3+, fr7           /* put one arg to frX */
2523102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #8, r0              /* frX not available now. */
2533102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    not     r0, r0
2543102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     r0, r13
2553102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     one_arg_handled
2563102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
2573102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
2583102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIjfloat_arg_3:
2593102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    tst     #4, r0
2603102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      jfloat_arg_4
2613102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  @r3+, fr6           /* put one arg to frX */
2623102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #4, r0              /* frX not available now. */
2633102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    not     r0, r0
2643102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     r0, r13
2653102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     one_arg_handled
2663102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
2673102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
2683102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIjfloat_arg_4:
2693102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    tst     #32, r0
2703102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      jfloat_arg_5
2713102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  @r3+, fr9           /* put one arg to frX */
2723102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #32, r0             /* frX not available now. */
2733102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    not     r0, r0
2743102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     r0, r13
2753102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     one_arg_handled
2763102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
2773102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
2783102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIjfloat_arg_5:
2793102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    tst     #16, r0
2803102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      jfloat_arg_6
2813102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  @r3+, fr8           /* put one arg to frX */
2823102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #16, r0             /* frX not available now. */
2833102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    not     r0, r0
2843102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     r0, r13
2853102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     one_arg_handled
2863102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
2873102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
2883102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIjfloat_arg_6:
2893102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    tst     #128, r0
2903102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      jfloat_arg_7
2913102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  @r3+, fr11          /* put one arg to frX */
2923102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #127, r0            /* frX not available now. */
2933102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    not     r0, r0
2943102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     r0, r13
2953102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     one_arg_handled
2963102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
2973102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
2983102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIjfloat_arg_7:
2993102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    tst     #64, r0
3003102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      jfloat_fatal_error
3013102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  @r3+, fr10          /* put one arg to frX */
3023102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #64, r0             /* frX not available now. */
3033102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    not     r0, r0
3043102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    and     r0, r13
3053102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     one_arg_handled
3063102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
3073102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3083102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIjfloat_fatal_error:
3093102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     jfloat_fatal_error:
3103102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
3113102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3123102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIarg_end:
3133102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3143102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3153102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI### reverse the variables on stack
3163102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     r14, r12            /* points to first arg on stack */
3173102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    add     #-20, r12
3183102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     r15, r13            /* points to last arg on stack */
3193102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIarg_rev_loop:
3203102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/hs  r12, r13            /* When r13 >= r12 (unsigned), 1->T */
3213102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      arg_rev_end
3223102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   @r12, r0
3233102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   @r13, r1
3243102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   r0, @r13
3253102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   r1, @r12
3263102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    add     #-4, r12
3273102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    add     #4, r13
3283102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     arg_rev_loop
3293102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
3303102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3313102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIarg_rev_end:
3323102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3333102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI### invoke the JNI function.
3343102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3353102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   @(8,r14), r0
3363102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    jsr     @r0
3373102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
3383102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3393102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI### pass the return value
3403102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3413102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    /*
3423102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI     * r0 and r1 keep return value.
3433102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI     */
3443102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3453102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ## fetch data
3463102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   @(4,r14), r2        /* reload shorty */
3473102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.b   @r2, r2             /* first byte specifyes return value type. */
3483102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   @(12,r14), r3       /* pReturn */
3493102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3503102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ## check return value types
3513102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3523102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #'V', r4
3533102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/eq  r4, r2
3543102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      end
3553102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3563102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #'F', r4
3573102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/eq  r4, r2
3583102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      jfloat_ret
3593102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3603102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #'D', r4
3613102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/eq  r4, r2
3623102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      jdouble_ret
3633102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3643102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #'J', r4
3653102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    cmp/eq  r4, r2
3663102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bt      jlong_ret
3673102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3683102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ## fall-through for other 32 bit java types.
3693102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3703102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ## load return values
3713102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIj32_ret:
3723102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     end
3733102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   r0, @r3             /* delay slot */
3743102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3753102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIjfloat_ret:
3763102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     end
3773102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  fr0, @r3            /* delay slot */
3783102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3793102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIjdouble_ret:
3803102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  fr1, @r3
3813102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     #4, r0
3823102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     end
3833102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    fmov.s  fr0, @(r0,r3)       /* delay slot */
3843102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3853102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIjlong_ret:
3863102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   r0, @r3
3873102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    bra     end
3883102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   r1, @(4,r3)         /* delay slot */
3893102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3903102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKIend:
3913102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    ## restore preserved registers
3923102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov     r14, r15
3933102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    add     #-16, r15
3943102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    lds.l   @r15+, pr
3953102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   @r15+, r12
3963102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   @r15+, r13
3973102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    mov.l   @r15+, r14
3983102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI
3993102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    rts                         /* dvmPlatformInvoke returns void. */
4003102d523c787402faf4590c7e25cef8c3e20afa4Shin-ichiro KAWASAKI    nop
401