Re: [Xen-devel] [PATCH v2 2/4] x86/emul: Optimise decode_register() somewhat

2018-01-31 Thread Jan Beulich
>>> On 30.01.18 at 16:56, wrote: > --- a/xen/arch/x86/x86_emulate/x86_emulate.c > +++ b/xen/arch/x86/x86_emulate/x86_emulate.c > @@ -1935,36 +1935,67 @@ load_seg( > return rc; > } > > +/* Map GPRs by ModRM encoding to their offset within struct cpu_user_regs. */

[Xen-devel] [PATCH v2 2/4] x86/emul: Optimise decode_register() somewhat

2018-01-30 Thread Andrew Cooper
The positions of GPRs inside struct cpu_user_regs doesn't follow any particular order, so as compiled, decode_register() becomes a jump table to 16 blocks which calculate the appropriate offset, at a total of 207 bytes. Instead, pre-compute the offsets at build time and use pointer arithmetic to