EmulationStateARM.h revision 353358
1//===-- EmulationStateARM.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-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef lldb_EmulationStateARM_h_
10#define lldb_EmulationStateARM_h_
11
12#include <map>
13
14#include "lldb/Core/EmulateInstruction.h"
15#include "lldb/Core/Opcode.h"
16
17class EmulationStateARM {
18public:
19  EmulationStateARM();
20
21  virtual ~EmulationStateARM();
22
23  bool StorePseudoRegisterValue(uint32_t reg_num, uint64_t value);
24
25  uint64_t ReadPseudoRegisterValue(uint32_t reg_num, bool &success);
26
27  bool StoreToPseudoAddress(lldb::addr_t p_address, uint32_t value);
28
29  uint32_t ReadFromPseudoAddress(lldb::addr_t p_address, bool &success);
30
31  void ClearPseudoRegisters();
32
33  void ClearPseudoMemory();
34
35  bool LoadPseudoRegistersFromFrame(lldb_private::StackFrame &frame);
36
37  bool LoadStateFromDictionary(lldb_private::OptionValueDictionary *test_data);
38
39  bool CompareState(EmulationStateARM &other_state);
40
41  static size_t
42  ReadPseudoMemory(lldb_private::EmulateInstruction *instruction, void *baton,
43                   const lldb_private::EmulateInstruction::Context &context,
44                   lldb::addr_t addr, void *dst, size_t length);
45
46  static size_t
47  WritePseudoMemory(lldb_private::EmulateInstruction *instruction, void *baton,
48                    const lldb_private::EmulateInstruction::Context &context,
49                    lldb::addr_t addr, const void *dst, size_t length);
50
51  static bool ReadPseudoRegister(lldb_private::EmulateInstruction *instruction,
52                                 void *baton,
53                                 const lldb_private::RegisterInfo *reg_info,
54                                 lldb_private::RegisterValue &reg_value);
55
56  static bool
57  WritePseudoRegister(lldb_private::EmulateInstruction *instruction,
58                      void *baton,
59                      const lldb_private::EmulateInstruction::Context &context,
60                      const lldb_private::RegisterInfo *reg_info,
61                      const lldb_private::RegisterValue &reg_value);
62
63private:
64  uint32_t m_gpr[17];
65  struct _sd_regs {
66    uint32_t s_regs[32]; // sregs 0 - 31 & dregs 0 - 15
67
68    uint64_t d_regs[16]; // dregs 16-31
69
70  } m_vfp_regs;
71
72  std::map<lldb::addr_t, uint32_t> m_memory; // Eventually will want to change
73                                             // uint32_t to a data buffer heap
74                                             // type.
75
76  DISALLOW_COPY_AND_ASSIGN(EmulationStateARM);
77};
78
79#endif // lldb_EmulationStateARM_h_
80