1b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith/*
2b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith * Copyright (C) 2014 The Android Open Source Project
3b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith *
4b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith * Licensed under the Apache License, Version 2.0 (the "License");
5b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith * you may not use this file except in compliance with the License.
6b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith * You may obtain a copy of the License at
7b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith *
8b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith *      http://www.apache.org/licenses/LICENSE-2.0
9b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith *
10b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith * Unless required by applicable law or agreed to in writing, software
11b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith * distributed under the License is distributed on an "AS IS" BASIS,
12b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith * See the License for the specific language governing permissions and
14b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith * limitations under the License.
15b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith */
16b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith
17b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith#ifndef ART_RUNTIME_ARCH_ARM64_ASM_SUPPORT_ARM64_S_
18b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith#define ART_RUNTIME_ARCH_ARM64_ASM_SUPPORT_ARM64_S_
19b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith
20b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith#include "asm_support_arm64.h"
21b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith
225c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe// Define special registers.
235c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe
245c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe// Register holding Thread::Current().
255c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe#define xSELF x18
26b551fdcda9eb128c80de37c4fb978968bec6d4b3Zheng Xu// x18 is not preserved by aapcs64, save it on xETR(External Thread reg) for restore and later use.
27b551fdcda9eb128c80de37c4fb978968bec6d4b3Zheng Xu#define xETR x21
285c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe// Frame Pointer
295c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe#define xFP   x29
305c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe// Link Register
315c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe#define xLR   x30
325c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe// Define the intraprocedural linkage temporary registers.
335c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe#define xIP0 x16
34b551fdcda9eb128c80de37c4fb978968bec6d4b3Zheng Xu#define wIP0 w16
355c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe#define xIP1 x17
36b551fdcda9eb128c80de37c4fb978968bec6d4b3Zheng Xu#define wIP1 w17
375c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe
385c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe
39b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith.macro ENTRY name
40b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith    .type \name, #function
4129b3841ad8c1c18ee7ddd2d8cab85806b3d62eaaAndreas Gampe    .hidden \name  // Hide this as a global symbol, so we do not incur plt calls.
4229b3841ad8c1c18ee7ddd2d8cab85806b3d62eaaAndreas Gampe    .global \name
4329b3841ad8c1c18ee7ddd2d8cab85806b3d62eaaAndreas Gampe    /* Cache alignment for function entry */
4429b3841ad8c1c18ee7ddd2d8cab85806b3d62eaaAndreas Gampe    .balign 16
4529b3841ad8c1c18ee7ddd2d8cab85806b3d62eaaAndreas Gampe\name:
4629b3841ad8c1c18ee7ddd2d8cab85806b3d62eaaAndreas Gampe    .cfi_startproc
4729b3841ad8c1c18ee7ddd2d8cab85806b3d62eaaAndreas Gampe.endm
4829b3841ad8c1c18ee7ddd2d8cab85806b3d62eaaAndreas Gampe
49b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith.macro END name
50b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith    .cfi_endproc
51b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith    .size \name, .-\name
52b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith.endm
53b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith
54b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith.macro UNIMPLEMENTED name
55b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith    ENTRY \name
56b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith    brk 0
57b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith    END \name
58b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith.endm
59b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith
60b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith#endif  // ART_RUNTIME_ARCH_ARM64_ASM_SUPPORT_ARM64_S_
61