[DynInst_API:] [dyninst/dyninst] 949510: Fix BPatch_registerExpr for SP and save/restore re...


Date: Wed, 23 Oct 2019 17:38:17 -0700
From: Sasha NÃcolas <noreply@xxxxxxxxxx>
Subject: [DynInst_API:] [dyninst/dyninst] 949510: Fix BPatch_registerExpr for SP and save/restore re...
  Branch: refs/heads/multiple_funcCall
  Home:   https://github.com/dyninst/dyninst
  Commit: 949510c7ee85fe515fa1abfa42ba1f40f6eb4477
      https://github.com/dyninst/dyninst/commit/949510c7ee85fe515fa1abfa42ba1f40f6eb4477
  Author: Sasha Nicolas (zeroah) <sasha@xxxxxxxxxxx>
  Date:   2019-10-23 (Wed, 23 Oct 2019)

  Changed paths:
    M dyninstAPI/src/BPatch_addressSpace.C
    M dyninstAPI/src/emit-aarch64.C
    M dyninstAPI/src/emit-aarch64.h
    M dyninstAPI/src/inst-aarch64.C
    M dyninstAPI/src/inst-aarch64.h
    M dyninstAPI/src/registerSpace.C

  Log Message:
  -----------
  Fix BPatch_registerExpr for SP and save/restore registers.

RegisterSpac::allocateSpecificRegister was marking the register as used,
making the next emitCall to save them.
This would cause loadLibrary to fail because getScratchRegister would
get x0 to generate the blr instruction, overriding the parameters.
Setting the registers used for parameters as offLimits before and unsetting
them back after emitting the instruction seemed the most reasonable.

EmitterAARCH64::emitMoveRegToReg had to be implemented.
EmitterAARCH64::emitLoadOrigRegister had to be fixed since REG_SP is 31
but registerSpace::sp is 64.
Now the BaseTramp also saves SP value in a fix position.


[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] [dyninst/dyninst] 949510: Fix BPatch_registerExpr for SP and save/restore re..., Sasha NÃcolas <=