ROSE  0.11.50.0
CallingConvention.h
1 #ifndef ROSE_BinaryAnalysis_CallingConvention_H
2 #define ROSE_BinaryAnalysis_CallingConvention_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
5 
6 #include <Rose/BinaryAnalysis/InstructionSemantics2/BaseSemantics.h>
7 #include <Rose/BinaryAnalysis/Variables.h>
8 #include <Rose/BinaryAnalysis/Partitioner2/BasicTypes.h>
9 #include <Rose/BinaryAnalysis/Registers.h>
10 #include <Rose/BinaryAnalysis/RegisterParts.h>
11 
12 #include <boost/serialization/access.hpp>
13 #include <boost/serialization/set.hpp>
14 #include <boost/serialization/string.hpp>
15 #include <boost/serialization/vector.hpp>
16 #include <Sawyer/SharedObject.h>
17 #include <Sawyer/SharedPointer.h>
18 
19 namespace Rose {
20 namespace BinaryAnalysis {
21 
22 // Forwards
23 class Disassembler;
24 
35 namespace CallingConvention {
36 
40 void initDiagnostics();
41 
46 
48 // Miscellaneous small types
50 
56 };
57 
62 };
63 
69 };
70 
71 
73 // ParameterLocation
75 
85  #undef ABSOLUTE
87 public:
89  enum Type {
94  };
95 
96 private:
97  Type type_;
98  RegisterDescriptor reg_; // The argument register, or the stack base register.
99  union {
100  int64_t offset_; // Offset from stack base register for stack-based locations.
101  rose_addr_t va_; // Absolute address
102  };
103 
104 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
105 private:
106  friend class boost::serialization::access;
107 
108  template<class S>
109  void serialize(S &s, const unsigned /*version*/) {
110  s & BOOST_SERIALIZATION_NVP(type_);
111  s & BOOST_SERIALIZATION_NVP(reg_);
112  if (STACK==type_) {
113  s & BOOST_SERIALIZATION_NVP(offset_);
114  } else {
115  s & BOOST_SERIALIZATION_NVP(va_);
116  }
117  }
118 #endif
119 
120 public:
127  : type_(NO_LOCATION), offset_(0) {}
128 
131  : type_(REGISTER), reg_(reg), offset_(0) {}
132 
135  : type_(STACK), reg_(reg), offset_(offset) {}
136 
138  explicit ParameterLocation(rose_addr_t va)
139  : type_(ABSOLUTE), va_(va) {}
140 
142  Type type() const { return type_; }
143 
147  bool isValid() const {
148  return type() != NO_LOCATION;
149  }
150 
157  return reg_;
158  }
159 
165  int64_t offset() const {
166  return STACK == type_ ? offset_ : (int64_t)0;
167  }
168 
173  rose_addr_t address() const {
174  return ABSOLUTE == type_ ? va_ : (rose_addr_t)0;
175  }
176 
180  bool operator==(const ParameterLocation &other) const {
181  return type_ == other.type_ && reg_ == other.reg_ && offset_ == other.offset_; // &va_ == &offset_
182  }
183 
187  bool operator!=(const ParameterLocation &other) const {
188  return type_ != other.type_ || reg_ != other.reg_ || offset_ != other.offset_; // &va_ == &offset_
189  }
190 
192  std::string toString(const RegisterDictionary *regdict) const {
193  std::ostringstream ss;
194  print(ss, RegisterNames(regdict));
195  return ss.str();
196  }
197 
201  void print(std::ostream &out, const RegisterDictionary *regdict) const {
202  print(out, RegisterNames(regdict));
203  }
204  void print(std::ostream &out, const RegisterNames &regnames) const {
205  switch (type_) {
206  case NO_LOCATION: out <<"nowhere"; break;
207  case REGISTER: out <<regnames(reg_); break;
208  case STACK: out <<"mem[" <<regnames(reg_) <<"+" <<offset_ <<"]"; break;
209  case ABSOLUTE: out <<"mem[" <<StringUtility::addrToString(va_) <<"]"; break;
210  }
211  }
214 };
215 
216 
218 // Definition
220 
223 
228 public:
231 
232 private:
233  std::string name_; // Official short name of the convention, like "stdcall".
234  std::string comment_; // Long name, like "Windows Borland x86-32 fastcall"
235  size_t wordWidth_; // Natural width word size in bits
236  const RegisterDictionary *regDict_; // Register dictionary used when this definition was created
237  std::vector<ParameterLocation> inputParameters_; // Input (inc. in-out) parameters; additional stack-based are implied
238  std::vector<ParameterLocation> outputParameters_; // Return values and output parameters.
239  StackParameterOrder stackParameterOrder_; // Order of arguments on the stack
240  RegisterDescriptor stackPointerRegister_; // Base pointer for implied stack parameters
241  size_t nonParameterStackSize_; // Size in bytes of non-parameter stack area
242  size_t stackAlignment_; // Stack alignment in bytes (zero means unknown)
243  StackDirection stackDirection_; // Direction that stack grows from a PUSH operation
244  StackCleanup stackCleanup_; // Who cleans up stack parameters?
245  ParameterLocation thisParameter_; // Object pointer for calling conventions that are object methods
246  std::set<RegisterDescriptor> calleeSavedRegisters_; // Register that the callee must restore before returning
247  std::set<RegisterDescriptor> scratchRegisters_; // Caller-saved registers
248 
249 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
250 private:
251  friend class boost::serialization::access;
252 
253  template<class S>
254  void serialize(S &s, const unsigned /*version*/) {
255  s & BOOST_SERIALIZATION_NVP(name_);
256  s & BOOST_SERIALIZATION_NVP(comment_);
257  s & BOOST_SERIALIZATION_NVP(wordWidth_);
258  s & BOOST_SERIALIZATION_NVP(regDict_);
259  s & BOOST_SERIALIZATION_NVP(inputParameters_);
260  s & BOOST_SERIALIZATION_NVP(outputParameters_);
261  s & BOOST_SERIALIZATION_NVP(stackParameterOrder_);
262  s & BOOST_SERIALIZATION_NVP(stackPointerRegister_);
263  s & BOOST_SERIALIZATION_NVP(nonParameterStackSize_);
264  s & BOOST_SERIALIZATION_NVP(stackAlignment_);
265  s & BOOST_SERIALIZATION_NVP(stackDirection_);
266  s & BOOST_SERIALIZATION_NVP(stackCleanup_);
267  s & BOOST_SERIALIZATION_NVP(thisParameter_);
268  s & BOOST_SERIALIZATION_NVP(calleeSavedRegisters_);
269  s & BOOST_SERIALIZATION_NVP(scratchRegisters_);
270  }
271 #endif
272 
273 protected:
278  : wordWidth_(0), regDict_(NULL), stackParameterOrder_(ORDER_UNSPECIFIED), nonParameterStackSize_(0),
279  stackAlignment_(0), stackDirection_(GROWS_DOWN), stackCleanup_(CLEANUP_UNSPECIFIED) {}
280 
286  Definition(size_t wordWidth, const std::string &name, const std::string &comment, const RegisterDictionary *regDict)
287  : name_(name), comment_(comment), wordWidth_(wordWidth), regDict_(regDict), stackParameterOrder_(ORDER_UNSPECIFIED),
288  nonParameterStackSize_(0), stackAlignment_(0), stackDirection_(GROWS_DOWN), stackCleanup_(CLEANUP_UNSPECIFIED) {
289  ASSERT_require2(0 == (wordWidth & 7) && wordWidth > 0, "word size must be a positive multiple of eight");
290  }
291 
292 public:
294  static Ptr instance(size_t wordWidth, const std::string &name, const std::string &comment, const RegisterDictionary *regs) {
295  return Ptr(new Definition(wordWidth, name, comment, regs));
296  }
297 
298 public:
302  static Ptr x86_32bit_cdecl();
303  static Ptr x86_64bit_cdecl();
304  static Ptr x86_32bit_stdcall();
305  static Ptr x86_64bit_stdcall();
306  static Ptr x86_32bit_fastcall();
307  static Ptr x86_64bit_sysv();
308  static Ptr ppc_32bit_ibm();
314  static Ptr x86_cdecl(const RegisterDictionary*);
315  static Ptr x86_stdcall(const RegisterDictionary*);
316  static Ptr x86_fastcall(const RegisterDictionary*);
317  static Ptr ppc_ibm(const RegisterDictionary*);
325  const RegisterDictionary* registerDictionary() const { return regDict_; }
326  void registerDictionary(const RegisterDictionary *d) { regDict_ = d; }
337  const std::string& name() const { return name_; }
338  void name(const std::string &s) { name_ = s; }
348  const std::string& comment() const { return comment_; }
349  void comment(const std::string &s) { comment_ = s; }
361  size_t wordWidth() const { return wordWidth_; }
362  void wordWidth(size_t nBits) {
363  ASSERT_require2(nBits > 0 && 0 == (nBits & 7), "word size must be a positive multiple of eight");
364  wordWidth_ = nBits;
365  }
374  thisParameter_ = ParameterLocation();
375  }
376 
381  const std::vector<ParameterLocation>& inputParameters() const { return inputParameters_; }
382 
385 
390  void clearInputParameters() { inputParameters_.clear(); }
391 
401  }
402  void appendInputParameter(RegisterDescriptor reg, int64_t offset) {
404  }
405  void appendInputParameter(rose_addr_t va) {
407  }
414  const std::vector<ParameterLocation>& outputParameters() const { return outputParameters_; }
415 
418 
423  void clearOutputParameters() { outputParameters_.clear(); }
424 
436  }
437  void appendOutputParameter(RegisterDescriptor reg, int64_t offset) {
439  }
440  void appendOutputParameter(rose_addr_t va) {
442  }
455  StackParameterOrder stackParameterOrder() const { return stackParameterOrder_; }
456  void stackParameterOrder(StackParameterOrder x) { stackParameterOrder_ = x; }
466  const RegisterDescriptor stackPointerRegister() const { return stackPointerRegister_; }
467  void stackPointerRegister(RegisterDescriptor r) { stackPointerRegister_ = r; }
477  size_t nonParameterStackSize() const {
478  return nonParameterStackSize_;
479  }
480  void nonParameterStackSize(size_t nBytes) {
481  nonParameterStackSize_ = nBytes;
482  }
492  StackDirection stackDirection() const { return stackDirection_; }
493  void stackDirection(StackDirection x) { stackDirection_ = x; }
503  StackCleanup stackCleanup() const { return stackCleanup_; }
504  void stackCleanup(StackCleanup x) { stackCleanup_ = x; }
513  size_t stackAlignment() const { return stackAlignment_; }
514  void stackAlignment(size_t nBytes) { stackAlignment_ = nBytes; }
531  const ParameterLocation& thisParameter() const { return thisParameter_; }
532  void thisParameter(const ParameterLocation &x) { thisParameter_ = x; }
535  }
536  void thisParameter(RegisterDescriptor reg, int64_t offset) {
537  thisParameter(ParameterLocation(reg, offset));
538  }
539  void thisParameter(rose_addr_t va) {
541  }
555  const std::set<RegisterDescriptor>& calleeSavedRegisters() const { return calleeSavedRegisters_; }
556  std::set<RegisterDescriptor>& calleeSavedRegisters() { return calleeSavedRegisters_; }
561 
569  const std::set<RegisterDescriptor>& scratchRegisters() const { return scratchRegisters_; }
570  std::set<RegisterDescriptor>& scratchRegisters() { return scratchRegisters_; }
575 
586 
591  void print(std::ostream&, const RegisterDictionary *regDict = NULL) const;
592 };
593 
594 
596 // Dictionary
598 
600 typedef std::vector<Definition::Ptr> Dictionary;
601 
603 const Dictionary& dictionaryAmd64();
604 
606 const Dictionary& dictionaryAarch32();
607 
609 const Dictionary& dictionaryAarch64();
610 
612 const Dictionary& dictionaryM68k();
613 
615 const Dictionary& dictionaryMips();
616 
618 const Dictionary& dictionaryPowerpc32();
619 
621 const Dictionary& dictionaryPowerpc64();
622 
624 const Dictionary& dictionaryX86();
625 
626 
628 // Analysis
630 
634 class Analysis {
635 private:
637  const RegisterDictionary *regDict_; // Names for the register parts
638  Definition::Ptr defaultCc_; // Default calling convention for called functions
639 
640  bool hasResults_; // Are the following data members initialized?
641  bool didConverge_; // Are the following data members valid (else only approximations)?
642  RegisterParts restoredRegisters_; // Registers accessed but restored
643  RegisterParts inputRegisters_; // Registers that serve as possible input parameters
644  RegisterParts outputRegisters_; // Registers that hold possible return values
645  Variables::StackVariables inputStackParameters_; // Stack variables serving as function inputs
646  Variables::StackVariables outputStackParameters_; // Stack variables serving as possible return values
647  Sawyer::Optional<int64_t> stackDelta_; // Change in stack across entire function
648  // Don't forget to update clearResults() and serialize() if you add more.
649 
650 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
651 private:
652  friend class boost::serialization::access;
653 
654  template<class S>
655  void serialize(S &s, const unsigned /*version*/) {
656  s & BOOST_SERIALIZATION_NVP(cpu_);
657  s & BOOST_SERIALIZATION_NVP(regDict_);
658  s & BOOST_SERIALIZATION_NVP(defaultCc_);
659  s & BOOST_SERIALIZATION_NVP(hasResults_);
660  s & BOOST_SERIALIZATION_NVP(didConverge_);
661  s & BOOST_SERIALIZATION_NVP(restoredRegisters_);
662  s & BOOST_SERIALIZATION_NVP(inputRegisters_);
663  s & BOOST_SERIALIZATION_NVP(outputRegisters_);
664  s & BOOST_SERIALIZATION_NVP(inputStackParameters_);
665  s & BOOST_SERIALIZATION_NVP(outputStackParameters_);
666  s & BOOST_SERIALIZATION_NVP(stackDelta_);
667  }
668 #endif
669 
670 public:
677  : regDict_(NULL), hasResults_(false), didConverge_(false) {}
678 
682  explicit Analysis(Disassembler *d)
683  : regDict_(NULL), hasResults_(false), didConverge_(false) {
684  init(d);
685  }
686 
694  : cpu_(cpu), regDict_(NULL), hasResults_(false), didConverge_(false) {}
695 
703  Definition::Ptr defaultCallingConvention() const { return defaultCc_; }
704  void defaultCallingConvention(const Definition::Ptr &x) { defaultCc_ = x; }
712  void analyzeFunction(const Partitioner2::Partitioner&, const Sawyer::SharedPointer<Partitioner2::Function>&);
713 
718  bool hasResults() const { return hasResults_; }
719 
724  bool didConverge() const { return didConverge_; }
725 
730  void clearResults();
731 
736  void clearNonResults();
737 
745  const RegisterDictionary* registerDictionary() const { return regDict_; }
746  void registerDictionary(const RegisterDictionary *d) { regDict_ = d; }
753  const RegisterParts& calleeSavedRegisters() const { return restoredRegisters_; }
754 
759  const RegisterParts& inputRegisters() const { return inputRegisters_; }
760 
765  const RegisterParts& outputRegisters() const { return outputRegisters_; }
766 
770  const Variables::StackVariables& inputStackParameters() const { return inputStackParameters_; }
771 
775  const Variables::StackVariables& outputStackParameters() const { return outputStackParameters_; }
776 
781  Sawyer::Optional<int64_t> stackDelta() const { return stackDelta_; }
782 
786  bool match(const Definition::Ptr&) const;
787 
793  Dictionary match(const Dictionary&) const;
794 
799  void print(std::ostream&, bool multiLine=false) const;
800 
801 private:
802  // Finish constructing
803  void init(Disassembler*);
804 
805  // Recompute the restoredRegisters_ data member.
806  void updateRestoredRegisters(const InstructionSemantics2::BaseSemantics::StatePtr &initialState,
808 
809  // Recompute the inputRegisters_ data member after updateRestoredRegisters is computed.
810  void updateInputRegisters(const InstructionSemantics2::BaseSemantics::StatePtr &state);
811 
812  // Recompute the outputRegisters_ data member after updateRestoredRegisters is computed.
813  void updateOutputRegisters(const InstructionSemantics2::BaseSemantics::StatePtr &state);
814 
815  // Recompute the input and output stack variables
816  void updateStackParameters(const Partitioner2::FunctionPtr &function,
819 
820  // Recomputes the stack delta
821  void updateStackDelta(const InstructionSemantics2::BaseSemantics::StatePtr &initialState,
823 };
824 
826 // Free functions
828 
829 std::ostream& operator<<(std::ostream&, const Definition&);
830 std::ostream& operator<<(std::ostream&, const Analysis&);
831 
832 } // namespace
833 } // namespace
834 } // namespace
835 
836 #endif
837 #endif
void print(std::ostream &out, const RegisterNames &regnames) const
Print location.
void thisParameter(rose_addr_t va)
Property: Object pointer parameter.
size_t wordWidth() const
Property: Word size in bits.
const Dictionary & dictionaryX86()
Common calling conventions for 32-bit x86.
const std::vector< ParameterLocation > & outputParameters() const
Property: List of output parameters.
void registerDictionary(const RegisterDictionary *d)
Property: Register dictionary.
StackParameterOrder stackParameterOrder() const
Property: Stack parameter order.
size_t stackAlignment() const
Property: Stack alignment.
const Dictionary & dictionaryM68k()
Common calling conventions for m68k.
void print(std::ostream &out, const RegisterDictionary *regdict) const
Print location.
StackDirection stackDirection() const
Property: Direction that stack grows for a push operation.
The called function pops all stack parameters.
std::string toString(const RegisterDictionary *regdict) const
String representation.
const Variables::StackVariables & outputStackParameters() const
Output stack parameters.
void wordWidth(size_t nBits)
Property: Word size in bits.
void stackDirection(StackDirection x)
Property: Direction that stack grows for a push operation.
void appendInputParameter(const ParameterLocation &)
Append input parameter.
RegisterDescriptor reg() const
Register part of location.
static Ptr x86_32bit_cdecl()
Returns a predefined, cached calling convention.
const RegisterDictionary * registerDictionary() const
Property: Register dictionary.
void appendOutputParameter(rose_addr_t va)
Append output parameter.
const Dictionary & dictionaryAarch64()
Common calling conventions for ARM AArch64.
Sawyer::SharedPointer< class Definition > DefinitionPtr
Reference counting pointer to calling convention definition.
void registerDictionary(const RegisterDictionary *d)
Property: Register dictionary.
Collection of streams.
Definition: Message.h:1606
static Ptr x86_32bit_stdcall()
Allocating constructor.
A push decrements the stack pointer.
static Ptr ppc_32bit_ibm()
Allocating constructor.
void thisParameter(RegisterDescriptor reg, int64_t offset)
Property: Object pointer parameter.
ParameterLocation(RegisterDescriptor reg)
Constructs a parameter in a register location.
ParameterLocation(RegisterDescriptor reg, int64_t offset)
Constructs a parameter at a register-relative memory address.
void thisParameter(const ParameterLocation &x)
Property: Object pointer parameter.
const Dictionary & dictionaryPowerpc64()
Common calling conventions for PowerPC-64.
boost::shared_ptr< State > StatePtr
Shared-ownership pointer to a semantic state.
StackDirection
The direction in which the stack grows.
Analysis(Disassembler *d)
Construct an analyzer using a specified disassembler.
bool operator!=(const ParameterLocation &other) const
Inequality.
const Dictionary & dictionaryAmd64()
Common calling conventions for amd64 (x86-64).
void appendInputParameter(rose_addr_t va)
Append input parameter.
Definition::Ptr defaultCallingConvention() const
Property: Default calling convention.
void thisParameter(RegisterDescriptor reg)
Property: Object pointer parameter.
void stackCleanup(StackCleanup x)
Property: Who pops stack parameters.
rose_addr_t address() const
Fixed address location.
Main namespace for the ROSE library.
RegisterParts inputRegisterParts() const
Compute the set of input registers.
RegisterParts scratchRegisterParts() const
Computes the set of scratch registers.
Holds a set of registers without regard for register boundaries.
Definition: RegisterParts.h:27
StackCleanup stackCleanup() const
Property: Who pops stack parameters.
static Ptr x86_fastcall(const RegisterDictionary *)
Constructs a new pre-defined calling convention based on a register dictionary.
Sawyer::Optional< int64_t > stackDelta() const
Concrete stack delta.
Reference-counting intrusive smart pointer.
Definition: SharedPointer.h:68
bool hasResults() const
Whether a function has been analyzed.
Sawyer::SharedPointer< Definition > Ptr
Reference counting pointer to calling convention definition.
const ParameterLocation & thisParameter() const
Property: Object pointer parameter.
boost::shared_ptr< Dispatcher > DispatcherPtr
Shared-ownership pointer to a semantics instruction dispatcher.
void comment(const std::string &s)
Property: Full name of calling convention.
const RegisterParts & calleeSavedRegisters() const
Callee-saved registers.
void stackParameterOrder(StackParameterOrder x)
Property: Stack parameter order.
const RegisterParts & inputRegisters() const
Input registers.
void print(std::ostream &, bool multiLine=false) const
Print information about the analysis results.
const Dictionary & dictionaryPowerpc32()
Common calling conventions for PowerPC-32.
bool operator==(const ParameterLocation &other) const
Equality.
std::vector< Definition::Ptr > Dictionary
A ordered collection of calling convention definitions.
const Dictionary & dictionaryMips()
Common calling conventions for MIPS.
void appendOutputParameter(const ParameterLocation &)
Append output parameter.
static Ptr x86_cdecl(const RegisterDictionary *)
Constructs a new pre-defined calling convention based on a register dictionary.
static Ptr instance(size_t wordWidth, const std::string &name, const std::string &comment, const RegisterDictionary *regs)
Allocating constructor.
const Variables::StackVariables & inputStackParameters() const
Input stack parameters.
const std::set< RegisterDescriptor > & calleeSavedRegisters() const
Property: Callee-saved registers.
Describes (part of) a physical CPU register.
void appendInputParameter(RegisterDescriptor reg)
Append input parameter.
ROSE_UTIL_API std::string addrToString(uint64_t value, size_t nbits=0)
Convert a virtual address to a string.
void nonParameterStackSize(size_t nBytes)
Property: Size of non-parameter stack area.
StackParameterOrder
The order that arguments are pushed onto the stack.
bool isValid() const
Predicate to determine if location is valid.
bool didConverge() const
Whether the analysis results are valid.
Information about calling conventions.
std::set< RegisterDescriptor > & scratchRegisters()
Property: Scratch registers.
Sawyer::Message::Facility mlog
Facility for diagnostic output.
Prints a register name even when no dictionary is available or when the dictionary doesn't contain an...
Definition: Registers.h:374
void clearOutputParameters()
Erase output parameters.
void appendInputParameter(RegisterDescriptor reg, int64_t offset)
Append input parameter.
void analyzeFunction(const Partitioner2::Partitioner &, const Sawyer::SharedPointer< Partitioner2::Function > &)
Analyze one function.
void print(std::ostream &, const RegisterDictionary *regDict=NULL) const
Print detailed information about this calling convention.
size_t nonParameterStackSize() const
Property: Size of non-parameter stack area.
Analysis(const InstructionSemantics2::BaseSemantics::DispatcherPtr &cpu)
Construct an analysis using a specified dispatcher.
static Ptr x86_stdcall(const RegisterDictionary *)
Constructs a new pre-defined calling convention based on a register dictionary.
RegisterParts outputRegisterParts() const
Computes the set of output registers.
bool match(const Definition::Ptr &) const
Determine whether a definition matches.
const RegisterDescriptor stackPointerRegister() const
Property: Register for implied stack parameters.
RegisterParts getUsedRegisterParts() const
Returns all registers mentioned in this definition.
const RegisterParts & outputRegisters() const
Output registers.
static Ptr x86_64bit_cdecl()
Allocating constructor.
void name(const std::string &s)
Property: Short name of calling convention.
Stack parameters pushed left to right (Pascal order).
ParameterLocation(rose_addr_t va)
Constructs a parameter at a fixed memory address.
StackCleanup
Who is responsible for popping stack parameters.
const RegisterDictionary * registerDictionary() const
Property: Register dictionary.
int64_t offset() const
Offset part of location.
Base class for reference counted objects.
Definition: SharedObject.h:64
void clearNonResults()
Clears everything but results.
void initDiagnostics()
Initialize diagnostics.
void clearResults()
Clear analysis results.
const std::vector< ParameterLocation > & inputParameters() const
Property: Enumerated input parameters.
Stack parameters pushed right to left (C order).
void clearInputParameters()
Erase enumerated input parameters.
void appendOutputParameter(RegisterDescriptor reg)
Append output parameter.
const std::string & name() const
Property: Short name of calling convention.
void stackAlignment(size_t nBytes)
Property: Stack alignment.
Stack parameter cleanup is unknown or unspecified.
Type type() const
Type of parameter location.
const Dictionary & dictionaryAarch32()
Common calling conventions for ARM AArch32.
Definition(size_t wordWidth, const std::string &name, const std::string &comment, const RegisterDictionary *regDict)
Allocating constructor.
Defines registers available for a particular architecture.
Definition: Registers.h:37
Stack parameter order is unknown or unspecified.
RegisterParts calleeSavedRegisterParts() const
Compute the set of callee-saved registers.
void defaultCallingConvention(const Definition::Ptr &x)
Property: Default calling convention.
const std::string & comment() const
Property: Full name of calling convention.
const std::set< RegisterDescriptor > & scratchRegisters() const
Property: Scratch registers.
static Ptr x86_32bit_fastcall()
Allocating constructor.
A push increments the stack pointer.
static Ptr x86_64bit_sysv()
Allocating constructor.
Virtual base class for instruction disassemblers.
Definition: Disassembler.h:50
static Ptr x86_64bit_stdcall()
Allocating constructor.
std::set< RegisterDescriptor > & calleeSavedRegisters()
Property: Callee-saved registers.
static Ptr ppc_ibm(const RegisterDictionary *)
Constructs a new pre-defined calling convention based on a register dictionary.
void stackPointerRegister(RegisterDescriptor r)
Property: Register for implied stack parameters.
void appendOutputParameter(RegisterDescriptor reg, int64_t offset)
Append output parameter.