[LoongArch][Clang] Make the parameters and return value of {x,}vorn.v builti ns ...
[llvm-project.git] / lldb / source / Plugins / Process / FreeBSDKernel / RegisterContextFreeBSDKernel_arm64.cpp
blob11843ddc82d97099f4a37429a83f917ca49d96f1
1 //===-- RegisterContextFreeBSDKernel_arm64.cpp ----------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 #include "RegisterContextFreeBSDKernel_arm64.h"
10 #include "Plugins/Process/Utility/lldb-arm64-register-enums.h"
12 #include "lldb/Target/Process.h"
13 #include "lldb/Target/Thread.h"
14 #include "lldb/Utility/RegisterValue.h"
15 #include "llvm/Support/Endian.h"
17 using namespace lldb;
18 using namespace lldb_private;
20 RegisterContextFreeBSDKernel_arm64::RegisterContextFreeBSDKernel_arm64(
21 Thread &thread, std::unique_ptr<RegisterInfoPOSIX_arm64> register_info_up,
22 lldb::addr_t pcb_addr)
23 : RegisterContextPOSIX_arm64(thread, std::move(register_info_up)),
24 m_pcb_addr(pcb_addr) {}
26 bool RegisterContextFreeBSDKernel_arm64::ReadGPR() { return true; }
28 bool RegisterContextFreeBSDKernel_arm64::ReadFPR() { return true; }
30 bool RegisterContextFreeBSDKernel_arm64::WriteGPR() {
31 assert(0);
32 return false;
35 bool RegisterContextFreeBSDKernel_arm64::WriteFPR() {
36 assert(0);
37 return false;
40 bool RegisterContextFreeBSDKernel_arm64::ReadRegister(
41 const RegisterInfo *reg_info, RegisterValue &value) {
42 if (m_pcb_addr == LLDB_INVALID_ADDRESS)
43 return false;
45 struct {
46 llvm::support::ulittle64_t x[30];
47 llvm::support::ulittle64_t lr;
48 llvm::support::ulittle64_t _reserved;
49 llvm::support::ulittle64_t sp;
50 } pcb;
52 Status error;
53 size_t rd =
54 m_thread.GetProcess()->ReadMemory(m_pcb_addr, &pcb, sizeof(pcb), error);
55 if (rd != sizeof(pcb))
56 return false;
58 uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB];
59 switch (reg) {
60 case gpr_x0_arm64:
61 case gpr_x1_arm64:
62 case gpr_x2_arm64:
63 case gpr_x3_arm64:
64 case gpr_x4_arm64:
65 case gpr_x5_arm64:
66 case gpr_x6_arm64:
67 case gpr_x7_arm64:
68 case gpr_x8_arm64:
69 case gpr_x9_arm64:
70 case gpr_x10_arm64:
71 case gpr_x11_arm64:
72 case gpr_x12_arm64:
73 case gpr_x13_arm64:
74 case gpr_x14_arm64:
75 case gpr_x15_arm64:
76 case gpr_x16_arm64:
77 case gpr_x17_arm64:
78 case gpr_x18_arm64:
79 case gpr_x19_arm64:
80 case gpr_x20_arm64:
81 case gpr_x21_arm64:
82 case gpr_x22_arm64:
83 case gpr_x23_arm64:
84 case gpr_x24_arm64:
85 case gpr_x25_arm64:
86 case gpr_x26_arm64:
87 case gpr_x27_arm64:
88 case gpr_x28_arm64:
89 case gpr_fp_arm64:
90 static_assert(gpr_fp_arm64 - gpr_x0_arm64 == 29,
91 "nonconsecutive arm64 register numbers");
92 value = pcb.x[reg - gpr_x0_arm64];
93 break;
94 case gpr_sp_arm64:
95 value = pcb.sp;
96 break;
97 case gpr_pc_arm64:
98 // The pc of crashing thread is stored in lr.
99 value = pcb.lr;
100 break;
101 default:
102 return false;
104 return true;
107 bool RegisterContextFreeBSDKernel_arm64::WriteRegister(
108 const RegisterInfo *reg_info, const RegisterValue &value) {
109 return false;