This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] x86-64: fix unused register determination for displaced stepping


>>> On 08.02.19 at 16:21,  wrote:
> For one, just like %rdx is an implied source operand for DIV/IDIV, %rcx
> is one for shifts and rotates. Hence the register is better excluded
> altogether as well. And then VEX- and XOP-encoded GPR insns often have a
> 3rd operand (encoded in the VEX/XOP prefix) which needs to be accounted
> for as well.
> 
> Then again %rbp was mistakenly recorded as used in the specific case of
> %rip-relative addressing we care about here. I'd like to note though
> that there's a certain risk associated with using %rbp as replacement
> base address register: Possible addressing related faults would then no
> longer surface as #GP(0), but #SS(0). But it doesn't look to have been
> the intention to avoid use of %rbp here.
> 
> As a side note, amd64_get_unused_input_int_reg() does too much for the
> limited purpose it's getting used for anyway: It'll get called with
> %rip-relative memory operands only, so
> - there's always a ModR/M byte,
> - ModR/M.mod is always going to be 0,
> - ModR/M.rm is always going to be 5.
> It might be worthwhile to remove the dead code (perhaps replaced by
> assertions), at which point the comment getting changed here could be
> adjusted in a different way, and it would become recognizable again that
> we indeed can't run out of available (unused) registers.
> 
> ---
> This takes "x86-64: fix displaced stepping for VEX, XOP, and EVEX
> encoded insns" as a prerequisite.
> 
> As with the earlier fix, time constraints are the reason for this not
> being accompanied by a testsuite extension.
> 
> gdb/
> 2019-02-08  Jan Beulich  <jbeulich@suse.com>
> 
> 	* amd64-tdep.c (): .

Btw, I've only now noticed this omission of mine. Here is the
missing chunk:

	* amd64-tdep.c (struct amd64_insn): New field vex_gpr.
	(amd64_get_unused_input_int_reg): Correct comment. Also avoid
	ECX. Don't record EBP as used when it's not. Use vex_gpr.
	(amd64_get_insn_details): Set vex_gpr.

Jan



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]