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

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



>>> On 30.01.18 at 16:56, <andrew.cooper3@xxxxxxxxxx> 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. */
> +static const uint8_t cpu_user_regs_gpr_offsets[] = {
> +    offsetof(struct cpu_user_regs, r(ax)),
> +    offsetof(struct cpu_user_regs, r(cx)),
> +    offsetof(struct cpu_user_regs, r(dx)),
> +    offsetof(struct cpu_user_regs, r(bx)),
> +    offsetof(struct cpu_user_regs, r(sp)),
> +    offsetof(struct cpu_user_regs, r(bp)),
> +    offsetof(struct cpu_user_regs, r(si)),
> +    offsetof(struct cpu_user_regs, r(di)),
> +#ifdef __x86_64__
> +    offsetof(struct cpu_user_regs, r8),
> +    offsetof(struct cpu_user_regs, r9),
> +    offsetof(struct cpu_user_regs, r10),
> +    offsetof(struct cpu_user_regs, r11),
> +    offsetof(struct cpu_user_regs, r12),
> +    offsetof(struct cpu_user_regs, r13),
> +    offsetof(struct cpu_user_regs, r14),
> +    offsetof(struct cpu_user_regs, r15),
> +#endif
> +};
> +
>  void *
>  decode_register(
>      uint8_t modrm_reg, struct cpu_user_regs *regs, int highbyte_regs)
>  {
> -    void *p;
> +    static const uint8_t byteop_offsets[] = {

byte_reg_offsets[] ?

With that (or a suitable other name not using "op" when registers
are meant)
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.