1/*
2 * Copyright (C) 2014 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#include "asm_support_arm64.S"
18
19    /*
20     * Jni dlsym lookup stub.
21     */
22    .extern artFindNativeMethod
23
24    // TODO: Add CFI directives.
25ENTRY art_jni_dlsym_lookup_stub
26  // spill regs.
27  stp   x29, x30, [sp, #-16]!
28  mov   x29, sp
29  stp   d6, d7,   [sp, #-16]!
30  stp   d4, d5,   [sp, #-16]!
31  stp   d2, d3,   [sp, #-16]!
32  stp   d0, d1,   [sp, #-16]!
33  stp   x6, x7,   [sp, #-16]!
34  stp   x4, x5,   [sp, #-16]!
35  stp   x2, x3,   [sp, #-16]!
36  stp   x0, x1,   [sp, #-16]!
37
38  bl  artFindNativeMethod
39  mov  x17, x0    // store result in scratch reg.
40
41  // load spill regs.
42  ldp   x0, x1,   [sp], #16
43  ldp   x2, x3,   [sp], #16
44  ldp   x4, x5,   [sp], #16
45  ldp   x6, x7,   [sp], #16
46  ldp   d0, d1,   [sp], #16
47  ldp   d2, d3,   [sp], #16
48  ldp   d4, d5,   [sp], #16
49  ldp   d6, d7,   [sp], #16
50  ldp   x29, x30, [sp], #16
51
52  cbz   x17, 1f   // is method code null ?
53  br    x17       // if non-null, tail call to method's code.
54
551:
56  ret             // restore regs and return to caller to handle exception.
57END art_jni_dlsym_lookup_stub
58