Re: [Xen-devel] [PATCH 1/2] x86emul: consolidate loop counter handling

2016-12-07 Thread Jan Beulich
>>> On 07.12.16 at 13:21, wrote: > On 07/12/16 09:56, Jan Beulich wrote: > On 06.12.16 at 17:20, wrote: >>> On 06/12/16 13:38, Jan Beulich wrote: @@ -3977,33 +3981,21 @@ x86_emulate( break; case 0xe0 ... 0xe2: /* loop{,z,nz} */ { +unsigned long

Re: [Xen-devel] [PATCH 1/2] x86emul: consolidate loop counter handling

2016-12-07 Thread Andrew Cooper
On 07/12/16 09:56, Jan Beulich wrote: On 06.12.16 at 17:20, wrote: >> On 06/12/16 13:38, Jan Beulich wrote: >>> @@ -3977,33 +3981,21 @@ x86_emulate( >>> break; >>> >>> case 0xe0 ... 0xe2: /* loop{,z,nz} */ { >>> +unsigned long count = get_loop_count(&_regs, ad_bytes) -

Re: [Xen-devel] [PATCH 1/2] x86emul: consolidate loop counter handling

2016-12-07 Thread Jan Beulich
>>> On 06.12.16 at 17:20, wrote: > On 06/12/16 13:38, Jan Beulich wrote: >> @@ -3977,33 +3981,21 @@ x86_emulate( >> break; >> >> case 0xe0 ... 0xe2: /* loop{,z,nz} */ { >> +unsigned long count = get_loop_count(&_regs, ad_bytes) - 1; >> int do_jmp = !(_regs.eflags &

Re: [Xen-devel] [PATCH 1/2] x86emul: consolidate loop counter handling

2016-12-06 Thread Andrew Cooper
On 06/12/16 13:38, Jan Beulich wrote: > Rename _get_rep_prefix() to make it more visibly fit other use cases > and introduce a companion "put". Use them for repeated string insn > handling as well as LOOP/J?CXZ instead of open coding the same logic a > couple of times. > > Signed-off-by: Jan Beulic

[Xen-devel] [PATCH 1/2] x86emul: consolidate loop counter handling

2016-12-06 Thread Jan Beulich
Rename _get_rep_prefix() to make it more visibly fit other use cases and introduce a companion "put". Use them for repeated string insn handling as well as LOOP/J?CXZ instead of open coding the same logic a couple of times. Signed-off-by: Jan Beulich --- a/xen/arch/x86/x86_emulate/x86_emulate.c