brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.8 KiB · e4597b2 Raw
95 lines · c
1//===-- NativeRegisterContextNetBSD_x86_64.h --------------------*- C++ -*-===//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-exception6//7//===----------------------------------------------------------------------===//8 9#if defined(__i386__) || defined(__x86_64__)10 11#ifndef lldb_NativeRegisterContextNetBSD_x86_64_h12#define lldb_NativeRegisterContextNetBSD_x86_64_h13 14// clang-format off15#include <sys/param.h>16#include <sys/types.h>17#include <sys/ptrace.h>18#include <machine/reg.h>19// clang-format on20 21#include <array>22#include <optional>23 24#include "Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h"25#include "Plugins/Process/Utility/RegisterContext_x86.h"26#include "Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h"27#include "Plugins/Process/Utility/lldb-x86-register-enums.h"28 29namespace lldb_private {30namespace process_netbsd {31 32class NativeProcessNetBSD;33 34class NativeRegisterContextNetBSD_x86_6435    : public NativeRegisterContextNetBSD,36      public NativeRegisterContextDBReg_x86 {37public:38  NativeRegisterContextNetBSD_x86_64(const ArchSpec &target_arch,39                                     NativeThreadProtocol &native_thread);40  uint32_t GetRegisterSetCount() const override;41 42  const RegisterSet *GetRegisterSet(uint32_t set_index) const override;43 44  Status ReadRegister(const RegisterInfo *reg_info,45                      RegisterValue &reg_value) override;46 47  Status WriteRegister(const RegisterInfo *reg_info,48                       const RegisterValue &reg_value) override;49 50  Status ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override;51 52  Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;53 54  llvm::Error55  CopyHardwareWatchpointsFrom(NativeRegisterContextNetBSD &source) override;56 57private:58  // Private member types.59  enum RegSetKind {60    GPRegSet,61    FPRegSet,62    DBRegSet,63    MaxRegularRegSet = DBRegSet,64    YMMRegSet,65    MPXRegSet,66    MaxRegSet = MPXRegSet,67  };68 69  // Private member variables.70  std::array<uint8_t, sizeof(struct reg)> m_gpr;71  std::array<uint8_t, sizeof(struct xstate)> m_xstate;72  std::array<uint8_t, sizeof(struct dbreg)> m_dbr;73  std::array<size_t, MaxRegularRegSet + 1> m_regset_offsets;74 75  std::optional<RegSetKind> GetSetForNativeRegNum(uint32_t reg_num) const;76 77  Status ReadRegisterSet(RegSetKind set);78  Status WriteRegisterSet(RegSetKind set);79 80  uint8_t *GetOffsetRegSetData(RegSetKind set, size_t reg_offset);81 82  struct YMMSplitPtr {83    void *xmm;84    void *ymm_hi;85  };86  std::optional<YMMSplitPtr> GetYMMSplitReg(uint32_t reg);87};88 89} // namespace process_netbsd90} // namespace lldb_private91 92#endif // #ifndef lldb_NativeRegisterContextNetBSD_x86_64_h93 94#endif // defined(__x86_64__)95