1//===-- ABISysV_x86_64.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 liblldb_ABISysV_x86_64_h_
11#define liblldb_ABISysV_x86_64_h_
12
13// C Includes
14// C++ Includes
15// Other libraries and framework includes
16// Project includes
17#include "lldb/lldb-private.h"
18#include "lldb/Target/ABI.h"
19
20class ABISysV_x86_64 :
21    public lldb_private::ABI
22{
23public:
24
25    ~ABISysV_x86_64()
26    {
27    }
28
29    virtual size_t
30    GetRedZoneSize () const;
31
32    virtual bool
33    PrepareTrivialCall (lldb_private::Thread &thread,
34                        lldb::addr_t sp,
35                        lldb::addr_t functionAddress,
36                        lldb::addr_t returnAddress,
37                        lldb::addr_t *arg1_ptr = NULL,
38                        lldb::addr_t *arg2_ptr = NULL,
39                        lldb::addr_t *arg3_ptr = NULL,
40                        lldb::addr_t *arg4_ptr = NULL,
41                        lldb::addr_t *arg5_ptr = NULL,
42                        lldb::addr_t *arg6_ptr = NULL) const;
43
44    virtual bool
45    GetArgumentValues (lldb_private::Thread &thread,
46                       lldb_private::ValueList &values) const;
47
48    virtual lldb_private::Error
49    SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value);
50
51protected:
52    lldb::ValueObjectSP
53    GetReturnValueObjectSimple (lldb_private::Thread &thread,
54                                lldb_private::ClangASTType &ast_type) const;
55
56public:
57    virtual lldb::ValueObjectSP
58    GetReturnValueObjectImpl (lldb_private::Thread &thread,
59                          lldb_private::ClangASTType &type) const;
60
61    virtual bool
62    CreateFunctionEntryUnwindPlan (lldb_private::UnwindPlan &unwind_plan);
63
64    virtual bool
65    CreateDefaultUnwindPlan (lldb_private::UnwindPlan &unwind_plan);
66
67    virtual bool
68    RegisterIsVolatile (const lldb_private::RegisterInfo *reg_info);
69
70    virtual bool
71    StackUsesFrames ()
72    {
73        return true;
74    }
75
76    virtual bool
77    CallFrameAddressIsValid (lldb::addr_t cfa)
78    {
79        // Make sure the stack call frame addresses are are 8 byte aligned
80        if (cfa & (8ull - 1ull))
81            return false;   // Not 8 byte aligned
82        if (cfa == 0)
83            return false;   // Zero is not a valid stack address
84        return true;
85    }
86
87    virtual bool
88    CodeAddressIsValid (lldb::addr_t pc)
89    {
90        // We have a 64 bit address space, so anything is valid as opcodes
91        // aren't fixed width...
92        return true;
93    }
94
95    virtual bool
96    FunctionCallsChangeCFA ()
97    {
98        return true;
99    }
100
101    virtual const lldb_private::RegisterInfo *
102    GetRegisterInfoArray (uint32_t &count);
103    //------------------------------------------------------------------
104    // Static Functions
105    //------------------------------------------------------------------
106    static void
107    Initialize();
108
109    static void
110    Terminate();
111
112    static lldb::ABISP
113    CreateInstance (const lldb_private::ArchSpec &arch);
114
115    static lldb_private::ConstString
116    GetPluginNameStatic();
117
118    //------------------------------------------------------------------
119    // PluginInterface protocol
120    //------------------------------------------------------------------
121    virtual lldb_private::ConstString
122    GetPluginName();
123
124    virtual uint32_t
125    GetPluginVersion();
126
127protected:
128    void
129    CreateRegisterMapIfNeeded ();
130
131    bool
132    RegisterIsCalleeSaved (const lldb_private::RegisterInfo *reg_info);
133
134private:
135    ABISysV_x86_64() : lldb_private::ABI() { } // Call CreateInstance instead.
136};
137
138#endif  // liblldb_ABI_h_
139