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#ifndef ART_RUNTIME_ARCH_ARM64_ASM_SUPPORT_ARM64_S_
18#define ART_RUNTIME_ARCH_ARM64_ASM_SUPPORT_ARM64_S_
19
20#include "asm_support_arm64.h"
21
22// Define special registers.
23
24// Register holding Thread::Current().
25#define xSELF x19
26// Frame Pointer
27#define xFP   x29
28// Link Register
29#define xLR   x30
30// Define the intraprocedural linkage temporary registers.
31#define xIP0 x16
32#define wIP0 w16
33#define xIP1 x17
34#define wIP1 w17
35
36#if defined(USE_READ_BARRIER) && defined(USE_BAKER_READ_BARRIER)
37// Marking Register, holding Thread::Current()->GetIsGcMarking().
38// Only used with the Concurrent Copying (CC) garbage
39// collector, with the Baker read barrier configuration.
40#define wMR w20
41#endif
42
43.macro ENTRY name
44    .type \name, #function
45    .hidden \name  // Hide this as a global symbol, so we do not incur plt calls.
46    .global \name
47    /* Cache alignment for function entry */
48    .balign 16
49\name:
50    .cfi_startproc
51.endm
52
53.macro END name
54    .cfi_endproc
55    .size \name, .-\name
56.endm
57
58.macro UNIMPLEMENTED name
59    ENTRY \name
60    brk 0
61    END \name
62.endm
63
64// Macro to poison (negate) the reference for heap poisoning.
65.macro POISON_HEAP_REF rRef
66#ifdef USE_HEAP_POISONING
67    neg \rRef, \rRef
68#endif  // USE_HEAP_POISONING
69.endm
70
71// Macro to unpoison (negate) the reference for heap poisoning.
72.macro UNPOISON_HEAP_REF rRef
73#ifdef USE_HEAP_POISONING
74    neg \rRef, \rRef
75#endif  // USE_HEAP_POISONING
76.endm
77
78#endif  // ART_RUNTIME_ARCH_ARM64_ASM_SUPPORT_ARM64_S_
79