1 //===-- ABISysV_mips64.h ----------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_ABISysV_mips64_h_
11 #define liblldb_ABISysV_mips64_h_
13 #include "lldb/Target/ABI.h"
14 #include "lldb/lldb-private.h"
16 class ABISysV_mips64 : public lldb_private::ABI {
18 ~ABISysV_mips64() override = default;
20 size_t GetRedZoneSize() const override;
22 bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
23 lldb::addr_t functionAddress,
24 lldb::addr_t returnAddress,
25 llvm::ArrayRef<lldb::addr_t> args) const override;
27 bool GetArgumentValues(lldb_private::Thread &thread,
28 lldb_private::ValueList &values) const override;
31 SetReturnValueObject(lldb::StackFrameSP &frame_sp,
32 lldb::ValueObjectSP &new_value) override;
35 GetReturnValueObjectImpl(lldb_private::Thread &thread,
36 lldb_private::CompilerType &type) const override;
39 CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
41 bool CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
43 bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
45 bool IsSoftFloat(uint32_t fp_flag) const;
47 // The SysV mips ABI requires that stack frames be 16 byte aligned.
48 // When there is a trap handler on the stack, e.g. _sigtramp in userland
49 // code, we've seen that the stack pointer is often not aligned properly
50 // before the handler is invoked. This means that lldb will stop the unwind
51 // early -- before the function which caused the trap.
53 // To work around this, we relax that alignment to be just word-size
55 // Whitelisting the trap handlers for user space would be easy (_sigtramp) but
56 // in other environments there can be a large number of different functions
57 // involved in async traps.
58 bool CallFrameAddressIsValid(lldb::addr_t cfa) override {
59 // Make sure the stack call frame addresses are 8 byte aligned
60 if (cfa & (8ull - 1ull))
61 return false; // Not 8 byte aligned
63 return false; // Zero is not a valid stack address
67 bool CodeAddressIsValid(lldb::addr_t pc) override {
68 if (pc & (4ull - 1ull))
69 return false; // Not 4 byte aligned
71 // Anything else if fair game..
75 const lldb_private::RegisterInfo *
76 GetRegisterInfoArray(uint32_t &count) override;
78 //------------------------------------------------------------------
80 //------------------------------------------------------------------
82 static void Initialize();
84 static void Terminate();
86 static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);
88 static lldb_private::ConstString GetPluginNameStatic();
90 //------------------------------------------------------------------
91 // PluginInterface protocol
92 //------------------------------------------------------------------
94 lldb_private::ConstString GetPluginName() override;
96 uint32_t GetPluginVersion() override;
99 void CreateRegisterMapIfNeeded();
102 GetReturnValueObjectSimple(lldb_private::Thread &thread,
103 lldb_private::CompilerType &ast_type) const;
105 bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info);
108 ABISysV_mips64(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) {
109 // Call CreateInstance instead.
113 #endif // liblldb_ABISysV_mips64_h_