lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rex.W prefix in jumps on x86_64


From: Paulo César Pereira de Andrade
Subject: Re: rex.W prefix in jumps on x86_64
Date: Fri, 21 Aug 2020 14:24:34 -0300

Em seg., 15 de jun. de 2020 às 12:04, Marc Nieper-Wißkirchen
<marc.nieper+gnu@gmail.com> escreveu:

  Hi,

  Sorry for the truly long delay in responding.

> PS:
>
> The following patch corrects at least my issue. (The _callr function
> already did the correct thing.) All tests pass (on an Intel Core
> i7-9700).
>
> diff --git a/lib/jit_x86-cpu.c b/lib/jit_x86-cpu.c
> index 8150fa1..1db522a 100644
> --- a/lib/jit_x86-cpu.c
> +++ b/lib/jit_x86-cpu.c
> @@ -3457,7 +3457,7 @@ _calli_p(jit_state_t *_jit, jit_word_t i0)
>  static void
>  _jmpr(jit_state_t *_jit, jit_int32_t r0)
>  {
> -    rex(0, WIDE, _NOREG, _NOREG, r0);
> +    rex(0, 0, _NOREG, _NOREG, r0);
>      ic(0xff);
>      mrm(0x03, 0x04, r7(r0));
>  }

  The WIDE argument forces a rex prefix. The patch is correct.
If the register argument is r8 or larger, the prefix will be added,
and disassembler will not show it is not required.
  I believe there are a few extra cases where a rex prefix is
forced, just that the disassembler does not show it. It is a single
byte, but the more bytes saved the better.

Thanks,
Paulo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]