From 518b5e5b1c71259ce0badc29f98db46a73c59442 Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Fri, 1 Oct 2010 16:02:46 -0500 Subject: Debug: Implement getArgument() and function skipping for ARM. In the process make add skipFuction() to handle isa specific function skipping instead of ifdefs and other ugliness. For almost all ABIs, 64 bit arguments can only start in even registers. Size is now passed to getArgument() so that 32 bit systems can make decisions about register selection for 64 bit arguments. The number argument is now passed by reference because getArgument() will need to change it based on the size of the argument and the current argument number. For ARM, if the argument number is odd and a 64-bit register is requested the number must first be incremented to because all 64 bit arguments are passed in an even argument register. Then the number will be incremented again to access both halves of the argument. --- src/arch/sparc/utility.cc | 12 +++++++++++- src/arch/sparc/utility.hh | 4 +++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src/arch/sparc') diff --git a/src/arch/sparc/utility.cc b/src/arch/sparc/utility.cc index 9a062e841..e14be48e2 100644 --- a/src/arch/sparc/utility.cc +++ b/src/arch/sparc/utility.cc @@ -45,7 +45,7 @@ namespace SparcISA { //the sixth are passed on the stack past the 16 word window save area, //space for the struct/union return pointer, and space reserved for the //first 6 arguments which the caller may use but doesn't have to. -uint64_t getArgument(ThreadContext *tc, int number, bool fp) { +uint64_t getArgument(ThreadContext *tc, int &number, uint8_t size, bool fp) { #if FULL_SYSTEM const int NumArgumentRegs = 6; if (number < NumArgumentRegs) { @@ -218,6 +218,16 @@ copyRegs(ThreadContext *src, ThreadContext *dest) dest->setNextNPC(src->readNextNPC()); } +void +skipFunction(ThreadContext *tc) +{ + Addr newpc = tc->readIntReg(ReturnAddressReg); + tc->setPC(newpc); + tc->setNextPC(tc->readPC() + sizeof(TheISA::MachInst)); + tc->setNextPC(tc->readNextPC() + sizeof(TheISA::MachInst)); +} + + void initCPU(ThreadContext *tc, int cpuId) { diff --git a/src/arch/sparc/utility.hh b/src/arch/sparc/utility.hh index 70044a6c2..39e23aa26 100644 --- a/src/arch/sparc/utility.hh +++ b/src/arch/sparc/utility.hh @@ -41,7 +41,7 @@ namespace SparcISA { - uint64_t getArgument(ThreadContext *tc, int number, bool fp); + uint64_t getArgument(ThreadContext *tc, int &number, uint8_t size, bool fp); static inline bool inUserMode(ThreadContext *tc) @@ -75,6 +75,8 @@ namespace SparcISA void copyMiscRegs(ThreadContext *src, ThreadContext *dest); + void skipFunction(ThreadContext *tc); + } // namespace SparcISA #endif -- cgit v1.2.3