Path: blob/main/contrib/llvm-project/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h
39646 views
//===-- ABISysV_ppc64.h ----------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLDB_SOURCE_PLUGINS_ABI_POWERPC_ABISYSV_PPC64_H9#define LLDB_SOURCE_PLUGINS_ABI_POWERPC_ABISYSV_PPC64_H1011#include "lldb/Target/ABI.h"12#include "lldb/lldb-private.h"1314class ABISysV_ppc64 : public lldb_private::RegInfoBasedABI {15public:16~ABISysV_ppc64() override = default;1718size_t GetRedZoneSize() const override;1920bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,21lldb::addr_t functionAddress,22lldb::addr_t returnAddress,23llvm::ArrayRef<lldb::addr_t> args) const override;2425bool GetArgumentValues(lldb_private::Thread &thread,26lldb_private::ValueList &values) const override;2728lldb_private::Status29SetReturnValueObject(lldb::StackFrameSP &frame_sp,30lldb::ValueObjectSP &new_value) override;3132lldb::ValueObjectSP33GetReturnValueObjectImpl(lldb_private::Thread &thread,34lldb_private::CompilerType &type) const override;3536bool37CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;3839bool CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;4041bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;4243// The SysV ppc64 ABI requires that stack frames be 16 byte aligned.44// When there is a trap handler on the stack, e.g. _sigtramp in userland45// code, we've seen that the stack pointer is often not aligned properly46// before the handler is invoked. This means that lldb will stop the unwind47// early -- before the function which caused the trap.48//49// To work around this, we relax that alignment to be just word-size50// (8-bytes).51// Allowing the trap handlers for user space would be easy (_sigtramp) but52// in other environments there can be a large number of different functions53// involved in async traps.54bool CallFrameAddressIsValid(lldb::addr_t cfa) override {55// Make sure the stack call frame addresses are 8 byte aligned56if (cfa & (8ull - 1ull))57return false; // Not 8 byte aligned58if (cfa == 0)59return false; // Zero is not a valid stack address60return true;61}6263bool CodeAddressIsValid(lldb::addr_t pc) override {64// We have a 64 bit address space, so anything is valid as opcodes65// aren't fixed width...66return true;67}6869const lldb_private::RegisterInfo *70GetRegisterInfoArray(uint32_t &count) override;7172// Static Functions7374static void Initialize();7576static void Terminate();7778static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);7980static llvm::StringRef GetPluginNameStatic() { return "sysv-ppc64"; }8182// PluginInterface protocol8384llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }8586protected:87void CreateRegisterMapIfNeeded();8889lldb::ValueObjectSP90GetReturnValueObjectSimple(lldb_private::Thread &thread,91lldb_private::CompilerType &ast_type) const;9293bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info);9495private:96using lldb_private::RegInfoBasedABI::RegInfoBasedABI; // Call CreateInstance instead.9798lldb::ByteOrder GetByteOrder() const;99};100101#endif // LLDB_SOURCE_PLUGINS_ABI_POWERPC_ABISYSV_PPC64_H102103104