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
24ENTRY art_jni_dlsym_lookup_stub
25  // spill regs.
26  stp   x29, x30, [sp, #-16]!
27  .cfi_adjust_cfa_offset 16
28  .cfi_rel_offset x29, 0
29  .cfi_rel_offset x30, 8
30  mov   x29, sp
31  stp   d6, d7,   [sp, #-16]!
32  .cfi_adjust_cfa_offset 16
33  stp   d4, d5,   [sp, #-16]!
34  .cfi_adjust_cfa_offset 16
35  stp   d2, d3,   [sp, #-16]!
36  .cfi_adjust_cfa_offset 16
37  stp   d0, d1,   [sp, #-16]!
38  .cfi_adjust_cfa_offset 16
39  stp   x6, x7,   [sp, #-16]!
40  .cfi_adjust_cfa_offset 16
41  stp   x4, x5,   [sp, #-16]!
42  .cfi_adjust_cfa_offset 16
43  stp   x2, x3,   [sp, #-16]!
44  .cfi_adjust_cfa_offset 16
45  stp   x0, x1,   [sp, #-16]!
46  .cfi_adjust_cfa_offset 16
47
48  bl  artFindNativeMethod
49  mov  x17, x0    // store result in scratch reg.
50
51  // load spill regs.
52  ldp   x0, x1,   [sp], #16
53  .cfi_adjust_cfa_offset -16
54  ldp   x2, x3,   [sp], #16
55  .cfi_adjust_cfa_offset -16
56  ldp   x4, x5,   [sp], #16
57  .cfi_adjust_cfa_offset -16
58  ldp   x6, x7,   [sp], #16
59  .cfi_adjust_cfa_offset -16
60  ldp   d0, d1,   [sp], #16
61  .cfi_adjust_cfa_offset -16
62  ldp   d2, d3,   [sp], #16
63  .cfi_adjust_cfa_offset -16
64  ldp   d4, d5,   [sp], #16
65  .cfi_adjust_cfa_offset -16
66  ldp   d6, d7,   [sp], #16
67  .cfi_adjust_cfa_offset -16
68  ldp   x29, x30, [sp], #16
69  .cfi_adjust_cfa_offset -16
70  .cfi_restore x29
71  .cfi_restore x30
72
73  cbz   x17, 1f   // is method code null ?
74  br    x17       // if non-null, tail call to method's code.
75
761:
77  ret             // restore regs and return to caller to handle exception.
78END art_jni_dlsym_lookup_stub
79