1 //===-- hwasan_registers.h --------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This describes the register state retrieved by hwasan when error reporting.
11 //===----------------------------------------------------------------------===//
13 #ifndef HWASAN_REGISTERS_H
14 #define HWASAN_REGISTERS_H
16 #include "sanitizer_common/sanitizer_common.h"
17 #include "sanitizer_common/sanitizer_platform.h"
19 #if defined(__aarch64__)
21 # define CAN_GET_REGISTERS 1
27 __attribute__((always_inline
, unused
)) static Registers
GetRegisters() {
30 "stp x0, x1, [%1, #(8 * 0)]\n"
31 "stp x2, x3, [%1, #(8 * 2)]\n"
32 "stp x4, x5, [%1, #(8 * 4)]\n"
33 "stp x6, x7, [%1, #(8 * 6)]\n"
34 "stp x8, x9, [%1, #(8 * 8)]\n"
35 "stp x10, x11, [%1, #(8 * 10)]\n"
36 "stp x12, x13, [%1, #(8 * 12)]\n"
37 "stp x14, x15, [%1, #(8 * 14)]\n"
38 "stp x16, x17, [%1, #(8 * 16)]\n"
39 "stp x18, x19, [%1, #(8 * 18)]\n"
40 "stp x20, x21, [%1, #(8 * 20)]\n"
41 "stp x22, x23, [%1, #(8 * 22)]\n"
42 "stp x24, x25, [%1, #(8 * 24)]\n"
43 "stp x26, x27, [%1, #(8 * 26)]\n"
44 "stp x28, x29, [%1, #(8 * 28)]\n"
47 regs
.x
[30] = reinterpret_cast<uintptr_t>(__builtin_return_address(0));
48 regs
.x
[31] = reinterpret_cast<uintptr_t>(__builtin_frame_address(0));
53 # define CAN_GET_REGISTERS 0
56 #endif // HWASAN_REGISTERS_H