EmulationStateARM.h revision 263363
1//===-- lldb_EmulationStateARM.h --------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef lldb_EmulationStateARM_h_
11#define lldb_EmulationStateARM_h_
12
13#include <map>
14
15#include "lldb/Core/EmulateInstruction.h"
16#include "lldb/Core/Opcode.h"
17
18class EmulationStateARM {
19public:
20
21    EmulationStateARM ();
22
23    virtual
24    ~EmulationStateARM ();
25
26    bool
27    StorePseudoRegisterValue (uint32_t reg_num, uint64_t value);
28
29    uint64_t
30    ReadPseudoRegisterValue (uint32_t reg_num, bool &success);
31
32    bool
33    StoreToPseudoAddress (lldb::addr_t p_address, uint64_t value, uint32_t size);
34
35    uint32_t
36    ReadFromPseudoAddress (lldb::addr_t p_address, uint32_t size, bool &success);
37
38    void
39    ClearPseudoRegisters ();
40
41    void
42    ClearPseudoMemory ();
43
44    bool
45    LoadPseudoRegistersFromFrame (lldb_private::StackFrame &frame);
46
47    bool
48    LoadStateFromDictionary (lldb_private::OptionValueDictionary *test_data);
49
50    bool
51    CompareState (EmulationStateARM &other_state);
52
53    static size_t
54    ReadPseudoMemory (lldb_private::EmulateInstruction *instruction,
55                      void *baton,
56                      const lldb_private::EmulateInstruction::Context &context,
57                      lldb::addr_t addr,
58                      void *dst,
59                      size_t length);
60
61    static size_t
62    WritePseudoMemory (lldb_private::EmulateInstruction *instruction,
63                       void *baton,
64                       const lldb_private::EmulateInstruction::Context &context,
65                       lldb::addr_t addr,
66                       const void *dst,
67                       size_t length);
68
69    static bool
70    ReadPseudoRegister (lldb_private::EmulateInstruction *instruction,
71                        void *baton,
72                        const lldb_private::RegisterInfo *reg_info,
73                        lldb_private::RegisterValue &reg_value);
74
75    static bool
76    WritePseudoRegister (lldb_private::EmulateInstruction *instruction,
77                         void *baton,
78                         const lldb_private::EmulateInstruction::Context &context,
79                         const lldb_private::RegisterInfo *reg_info,
80                         const lldb_private::RegisterValue &reg_value);
81private:
82    uint32_t m_gpr[17];
83    struct _sd_regs
84    {
85        union
86        {
87            uint32_t s_reg[2];
88            uint64_t d_reg;
89        } sd_regs[16];  // sregs 0 - 31 & dregs 0 - 15
90
91        uint64_t d_regs[16]; // dregs 16-31
92
93    } m_vfp_regs;
94
95    std::map<lldb::addr_t, uint32_t> m_memory; // Eventually will want to change uint32_t to a data buffer heap type.
96
97    DISALLOW_COPY_AND_ASSIGN (EmulationStateARM);
98};
99
100#endif  // lldb_EmulationStateARM_h_
101