LLDB mainline
Classes | Public Member Functions | Private Types | Static Private Member Functions | Private Attributes | List of all members
lldb_private::LinuxArm64RegisterFlags Class Reference

This class manages the storage and detection of register field information for Arm64 Linux registers. More...

#include <RegisterFlagsLinux_arm64.h>

Classes

struct  RegisterEntry
 

Public Member Functions

void DetectFields (uint64_t hwcap, uint64_t hwcap2)
 For the registers listed in this class, detect which fields are present.
 
void UpdateRegisterInfo (const RegisterInfo *reg_info, uint32_t num_regs)
 Add the field information of any registers named in this class, to the relevant RegisterInfo instances.
 
bool HasDetected () const
 Returns true if field detection has been run at least once.
 

Private Types

using Fields = std::vector< RegisterFlags::Field >
 
using DetectorFn = std::function< Fields(uint64_t, uint64_t)>
 

Static Private Member Functions

static Fields DetectCPSRFields (uint64_t hwcap, uint64_t hwcap2)
 
static Fields DetectFPSRFields (uint64_t hwcap, uint64_t hwcap2)
 
static Fields DetectFPCRFields (uint64_t hwcap, uint64_t hwcap2)
 
static Fields DetectMTECtrlFields (uint64_t hwcap, uint64_t hwcap2)
 
static Fields DetectSVCRFields (uint64_t hwcap, uint64_t hwcap2)
 

Private Attributes

struct lldb_private::LinuxArm64RegisterFlags::RegisterEntry m_registers [5]
 
bool m_has_detected = false
 

Detailed Description

This class manages the storage and detection of register field information for Arm64 Linux registers.

The same register may have different fields on different CPUs. This class abstracts out the field detection process so we can use it on live processes and core files.

The general way to use this class is:

This must be done in that order, and you should ensure that if multiple threads will reference the information, a mutex is used to make sure only one calls DetectFields.

Definition at line 36 of file RegisterFlagsLinux_arm64.h.

Member Typedef Documentation

◆ DetectorFn

using lldb_private::LinuxArm64RegisterFlags::DetectorFn = std::function<Fields(uint64_t, uint64_t)>
private

Definition at line 56 of file RegisterFlagsLinux_arm64.h.

◆ Fields

Definition at line 55 of file RegisterFlagsLinux_arm64.h.

Member Function Documentation

◆ DetectCPSRFields()

LinuxArm64RegisterFlags::Fields LinuxArm64RegisterFlags::DetectCPSRFields ( uint64_t  hwcap,
uint64_t  hwcap2 
)
staticprivate

Definition at line 110 of file RegisterFlagsLinux_arm64.cpp.

References HWCAP2_BTI, HWCAP2_MTE, HWCAP_DIT, and HWCAP_SSBS.

◆ DetectFields()

void LinuxArm64RegisterFlags::DetectFields ( uint64_t  hwcap,
uint64_t  hwcap2 
)

For the registers listed in this class, detect which fields are present.

Must be called before UpdateRegisterInfos. If called more than once, fields will be redetected each time from scratch. If you do not have access to hwcap, just pass 0 for each one, you will only get unconditional fields.

Definition at line 155 of file RegisterFlagsLinux_arm64.cpp.

References m_has_detected, and m_registers.

Referenced by RegisterContextCorePOSIX_arm64::RegisterContextCorePOSIX_arm64().

◆ DetectFPCRFields()

LinuxArm64RegisterFlags::Fields LinuxArm64RegisterFlags::DetectFPCRFields ( uint64_t  hwcap,
uint64_t  hwcap2 
)
staticprivate

Definition at line 54 of file RegisterFlagsLinux_arm64.cpp.

References HWCAP2_AFP, HWCAP2_EBF16, HWCAP_ASIMDHP, and HWCAP_FPHP.

◆ DetectFPSRFields()

LinuxArm64RegisterFlags::Fields LinuxArm64RegisterFlags::DetectFPSRFields ( uint64_t  hwcap,
uint64_t  hwcap2 
)
staticprivate

Definition at line 90 of file RegisterFlagsLinux_arm64.cpp.

◆ DetectMTECtrlFields()

LinuxArm64RegisterFlags::Fields LinuxArm64RegisterFlags::DetectMTECtrlFields ( uint64_t  hwcap,
uint64_t  hwcap2 
)
staticprivate

Definition at line 41 of file RegisterFlagsLinux_arm64.cpp.

◆ DetectSVCRFields()

LinuxArm64RegisterFlags::Fields LinuxArm64RegisterFlags::DetectSVCRFields ( uint64_t  hwcap,
uint64_t  hwcap2 
)
staticprivate

Definition at line 28 of file RegisterFlagsLinux_arm64.cpp.

◆ HasDetected()

bool lldb_private::LinuxArm64RegisterFlags::HasDetected ( ) const
inline

Returns true if field detection has been run at least once.

Definition at line 52 of file RegisterFlagsLinux_arm64.h.

References m_has_detected.

◆ UpdateRegisterInfo()

void LinuxArm64RegisterFlags::UpdateRegisterInfo ( const RegisterInfo reg_info,
uint32_t  num_regs 
)

Add the field information of any registers named in this class, to the relevant RegisterInfo instances.

Note that this will be done with a pointer to the instance of this class that you call this on, so the lifetime of that instance must be at least that of the register info.

Definition at line 161 of file RegisterFlagsLinux_arm64.cpp.

References lldb_private::RegisterInfo::flags_type, m_has_detected, and m_registers.

Referenced by RegisterContextCorePOSIX_arm64::RegisterContextCorePOSIX_arm64().

Member Data Documentation

◆ m_has_detected

bool lldb_private::LinuxArm64RegisterFlags::m_has_detected = false
private

Definition at line 81 of file RegisterFlagsLinux_arm64.h.

Referenced by DetectFields(), HasDetected(), and UpdateRegisterInfo().

◆ m_registers

struct lldb_private::LinuxArm64RegisterFlags::RegisterEntry lldb_private::LinuxArm64RegisterFlags::m_registers[5]
private
Initial value:
= {
RegisterEntry("cpsr", 4, DetectCPSRFields),
RegisterEntry("fpsr", 4, DetectFPSRFields),
RegisterEntry("fpcr", 4, DetectFPCRFields),
RegisterEntry("mte_ctrl", 8, DetectMTECtrlFields),
RegisterEntry("svcr", 8, DetectSVCRFields),
}
static Fields DetectCPSRFields(uint64_t hwcap, uint64_t hwcap2)
static Fields DetectFPSRFields(uint64_t hwcap, uint64_t hwcap2)
static Fields DetectFPCRFields(uint64_t hwcap, uint64_t hwcap2)
static Fields DetectMTECtrlFields(uint64_t hwcap, uint64_t hwcap2)
static Fields DetectSVCRFields(uint64_t hwcap, uint64_t hwcap2)

Referenced by DetectFields(), and UpdateRegisterInfo().


The documentation for this class was generated from the following files: