xref: /openbsd-src/gnu/llvm/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.h (revision f6aab3d83b51b91c24247ad2c2573574de475a82)
1061da546Spatrick //===-- EmulationStateARM.h -------------------------------------*- C++ -*-===//
2061da546Spatrick //
3061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4061da546Spatrick // See https://llvm.org/LICENSE.txt for license information.
5061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6061da546Spatrick //
7061da546Spatrick //===----------------------------------------------------------------------===//
8061da546Spatrick 
9dda28197Spatrick #ifndef LLDB_SOURCE_PLUGINS_INSTRUCTION_ARM_EMULATIONSTATEARM_H
10dda28197Spatrick #define LLDB_SOURCE_PLUGINS_INSTRUCTION_ARM_EMULATIONSTATEARM_H
11061da546Spatrick 
12061da546Spatrick #include <map>
13061da546Spatrick 
14061da546Spatrick #include "lldb/Core/EmulateInstruction.h"
15061da546Spatrick #include "lldb/Core/Opcode.h"
16061da546Spatrick 
17061da546Spatrick class EmulationStateARM {
18061da546Spatrick public:
19061da546Spatrick   EmulationStateARM();
20061da546Spatrick 
21061da546Spatrick   virtual ~EmulationStateARM();
22061da546Spatrick 
23061da546Spatrick   bool StorePseudoRegisterValue(uint32_t reg_num, uint64_t value);
24061da546Spatrick 
25061da546Spatrick   uint64_t ReadPseudoRegisterValue(uint32_t reg_num, bool &success);
26061da546Spatrick 
27061da546Spatrick   bool StoreToPseudoAddress(lldb::addr_t p_address, uint32_t value);
28061da546Spatrick 
29061da546Spatrick   uint32_t ReadFromPseudoAddress(lldb::addr_t p_address, bool &success);
30061da546Spatrick 
31061da546Spatrick   void ClearPseudoRegisters();
32061da546Spatrick 
33061da546Spatrick   void ClearPseudoMemory();
34061da546Spatrick 
35061da546Spatrick   bool LoadStateFromDictionary(lldb_private::OptionValueDictionary *test_data);
36061da546Spatrick 
37*f6aab3d8Srobert   bool CompareState(EmulationStateARM &other_state,
38*f6aab3d8Srobert                     lldb_private::Stream *out_stream);
39061da546Spatrick 
40061da546Spatrick   static size_t
41061da546Spatrick   ReadPseudoMemory(lldb_private::EmulateInstruction *instruction, void *baton,
42061da546Spatrick                    const lldb_private::EmulateInstruction::Context &context,
43061da546Spatrick                    lldb::addr_t addr, void *dst, size_t length);
44061da546Spatrick 
45061da546Spatrick   static size_t
46061da546Spatrick   WritePseudoMemory(lldb_private::EmulateInstruction *instruction, void *baton,
47061da546Spatrick                     const lldb_private::EmulateInstruction::Context &context,
48061da546Spatrick                     lldb::addr_t addr, const void *dst, size_t length);
49061da546Spatrick 
50061da546Spatrick   static bool ReadPseudoRegister(lldb_private::EmulateInstruction *instruction,
51061da546Spatrick                                  void *baton,
52061da546Spatrick                                  const lldb_private::RegisterInfo *reg_info,
53061da546Spatrick                                  lldb_private::RegisterValue &reg_value);
54061da546Spatrick 
55061da546Spatrick   static bool
56061da546Spatrick   WritePseudoRegister(lldb_private::EmulateInstruction *instruction,
57061da546Spatrick                       void *baton,
58061da546Spatrick                       const lldb_private::EmulateInstruction::Context &context,
59061da546Spatrick                       const lldb_private::RegisterInfo *reg_info,
60061da546Spatrick                       const lldb_private::RegisterValue &reg_value);
61061da546Spatrick 
62061da546Spatrick private:
63*f6aab3d8Srobert   bool LoadRegistersStateFromDictionary(
64*f6aab3d8Srobert       lldb_private::OptionValueDictionary *reg_dict, char kind, int first_reg,
65*f6aab3d8Srobert       int num);
66*f6aab3d8Srobert 
67be691f3bSpatrick   uint32_t m_gpr[17] = {0};
68061da546Spatrick   struct _sd_regs {
69061da546Spatrick     uint32_t s_regs[32]; // sregs 0 - 31 & dregs 0 - 15
70061da546Spatrick 
71061da546Spatrick     uint64_t d_regs[16]; // dregs 16-31
72061da546Spatrick 
73061da546Spatrick   } m_vfp_regs;
74061da546Spatrick 
75061da546Spatrick   std::map<lldb::addr_t, uint32_t> m_memory; // Eventually will want to change
76061da546Spatrick                                              // uint32_t to a data buffer heap
77061da546Spatrick                                              // type.
78061da546Spatrick 
79dda28197Spatrick   EmulationStateARM(const EmulationStateARM &) = delete;
80dda28197Spatrick   const EmulationStateARM &operator=(const EmulationStateARM &) = delete;
81061da546Spatrick };
82061da546Spatrick 
83dda28197Spatrick #endif // LLDB_SOURCE_PLUGINS_INSTRUCTION_ARM_EMULATIONSTATEARM_H
84