diff options
-rw-r--r-- | lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp b/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp index e7943b9aa9c..0c8aae3317e 100644 --- a/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp +++ b/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp @@ -226,7 +226,7 @@ ABISysV_hexagon::PrepareTrivialCall ( Thread &thread, // . handle 64bit values and their register / stack requirements */ -#define HEX_ABI_DEBUG 1 +#define HEX_ABI_DEBUG 0 bool ABISysV_hexagon::PrepareTrivialCall ( Thread &thread, lldb::addr_t sp , @@ -242,6 +242,23 @@ ABISysV_hexagon::PrepareTrivialCall ( Thread &thread, // grab the process so we have access to the memory for spilling lldb::ProcessSP proc = thread.GetProcess( ); + // get the register context for modifying all of the registers + RegisterContext *reg_ctx = thread.GetRegisterContext().get(); + if (!reg_ctx) + return false; + + uint32_t pc_reg = reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC); + if (pc_reg == LLDB_INVALID_REGNUM) + return false; + + uint32_t ra_reg = reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA); + if (ra_reg == LLDB_INVALID_REGNUM) + return false; + + uint32_t sp_reg = reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP); + if (sp_reg == LLDB_INVALID_REGNUM) + return false; + // push host data onto target for ( size_t i = 0; i < args.size( ); i++ ) { @@ -276,11 +293,6 @@ ABISysV_hexagon::PrepareTrivialCall ( Thread &thread, // check if this is a variable argument function bool isVArg = prototype.isFunctionVarArg(); - // get the register context for modifying all of the registers - RegisterContext *reg_ctx = thread.GetRegisterContext().get(); - if (!reg_ctx) - return false; - // number of arguments passed by register int nRegArgs = nVArgRegParams; if (! isVArg ) @@ -323,10 +335,9 @@ ABISysV_hexagon::PrepareTrivialCall ( Thread &thread, } // update registers with current function call state - reg_ctx->WriteRegisterFromUnsigned ( 41, pc ); - reg_ctx->WriteRegisterFromUnsigned ( 31, ra ); - reg_ctx->WriteRegisterFromUnsigned ( 29, sp ); -// reg_ctx->WriteRegisterFromUnsigned ( FP ??? ); + reg_ctx->WriteRegisterFromUnsigned(pc_reg, pc); + reg_ctx->WriteRegisterFromUnsigned(ra_reg, ra); + reg_ctx->WriteRegisterFromUnsigned(sp_reg, sp); #if HEX_ABI_DEBUG // quick and dirty stack dumper for debugging |