[CFT PATCH 0/4] target/i386/emulate: cleanups

Paolo Bonzini posted 4 patches 6 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250502214841.242584-1-pbonzini@redhat.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Zhao Liu <zhao1.liu@intel.com>, Cameron Esfahani <dirty@apple.com>, Roman Bolshakov <rbolshakov@ddn.com>, Phil Dennis-Jordan <phil@philjordan.eu>, Wei Liu <wei.liu@kernel.org>
target/i386/cpu.h                |   6 -
target/i386/emulate/x86_decode.h |   9 +-
target/i386/emulate/x86_emu.h    |   8 +-
target/i386/emulate/x86_flags.h  |  12 +-
target/i386/emulate/x86_decode.c |  76 ++++++------
target/i386/emulate/x86_emu.c    | 125 +++++++++----------
target/i386/emulate/x86_flags.c  | 198 +++++++++++++------------------
7 files changed, 197 insertions(+), 237 deletions(-)
[CFT PATCH 0/4] target/i386/emulate: cleanups
Posted by Paolo Bonzini 6 months, 2 weeks ago
These are some improvements to the x86 emulator that I wrote but have no
way of testing (right now).

I tried to place them in order of importance so that, if something breaks,
it is possible to commit a subset.  I tried to compile the resulting code
on Linux but I have not run it.

Patch 1 is just to fix warnings on Linux.

Patch 2 is the most important, as it fixes some real horrors in the code.

Patch 3 makes flags handling use algorithms somewhat similar to TCG.
It should fix issues with 64-bit ALU operations, but it's also the one
where it's more likely to have a mistake.

Patch 4 is comparatively trivial, though I cannot exclude any screwups.

It should be possible to test this with both HVF and Hyper-V.

Paolo

Paolo Bonzini (4):
  target/i386/emulate: fix target_ulong format strings
  target/i386/emulate: stop overloading decode->op[N].ptr
  target/i386/emulate: mostly rewrite flags handling
  target/i386: remove lflags

 target/i386/cpu.h                |   6 -
 target/i386/emulate/x86_decode.h |   9 +-
 target/i386/emulate/x86_emu.h    |   8 +-
 target/i386/emulate/x86_flags.h  |  12 +-
 target/i386/emulate/x86_decode.c |  76 ++++++------
 target/i386/emulate/x86_emu.c    | 125 +++++++++----------
 target/i386/emulate/x86_flags.c  | 198 +++++++++++++------------------
 7 files changed, 197 insertions(+), 237 deletions(-)

-- 
2.49.0
Re: [CFT PATCH 0/4] target/i386/emulate: cleanups
Posted by Wei Liu 6 months, 2 weeks ago
Magnus, can you test this series on MSHV?

On Fri, May 02, 2025 at 11:48:37PM +0200, Paolo Bonzini wrote:
> These are some improvements to the x86 emulator that I wrote but have no
> way of testing (right now).
> 
> I tried to place them in order of importance so that, if something breaks,
> it is possible to commit a subset.  I tried to compile the resulting code
> on Linux but I have not run it.
> 
> Patch 1 is just to fix warnings on Linux.
> 
> Patch 2 is the most important, as it fixes some real horrors in the code.
> 
> Patch 3 makes flags handling use algorithms somewhat similar to TCG.
> It should fix issues with 64-bit ALU operations, but it's also the one
> where it's more likely to have a mistake.
> 
> Patch 4 is comparatively trivial, though I cannot exclude any screwups.
> 
> It should be possible to test this with both HVF and Hyper-V.
> 
> Paolo
> 
> Paolo Bonzini (4):
>   target/i386/emulate: fix target_ulong format strings
>   target/i386/emulate: stop overloading decode->op[N].ptr
>   target/i386/emulate: mostly rewrite flags handling
>   target/i386: remove lflags
> 
>  target/i386/cpu.h                |   6 -
>  target/i386/emulate/x86_decode.h |   9 +-
>  target/i386/emulate/x86_emu.h    |   8 +-
>  target/i386/emulate/x86_flags.h  |  12 +-
>  target/i386/emulate/x86_decode.c |  76 ++++++------
>  target/i386/emulate/x86_emu.c    | 125 +++++++++----------
>  target/i386/emulate/x86_flags.c  | 198 +++++++++++++------------------
>  7 files changed, 197 insertions(+), 237 deletions(-)
> 
> -- 
> 2.49.0
>
Re: [CFT PATCH 0/4] target/i386/emulate: cleanups
Posted by Wei Liu 6 months, 2 weeks ago
On Fri, May 02, 2025 at 11:48:37PM +0200, Paolo Bonzini wrote:
> These are some improvements to the x86 emulator that I wrote but have no
> way of testing (right now).
> 
> I tried to place them in order of importance so that, if something breaks,
> it is possible to commit a subset.  I tried to compile the resulting code
> on Linux but I have not run it.
> 
> Patch 1 is just to fix warnings on Linux.
> 
> Patch 2 is the most important, as it fixes some real horrors in the code.
> 
> Patch 3 makes flags handling use algorithms somewhat similar to TCG.
> It should fix issues with 64-bit ALU operations, but it's also the one
> where it's more likely to have a mistake.
> 
> Patch 4 is comparatively trivial, though I cannot exclude any screwups.
> 
> It should be possible to test this with both HVF and Hyper-V.
> 
> Paolo

FWIW this series builds fine on for x86 HVF.

Thanks,
Wei.

> 
> Paolo Bonzini (4):
>   target/i386/emulate: fix target_ulong format strings
>   target/i386/emulate: stop overloading decode->op[N].ptr
>   target/i386/emulate: mostly rewrite flags handling
>   target/i386: remove lflags
> 
>  target/i386/cpu.h                |   6 -
>  target/i386/emulate/x86_decode.h |   9 +-
>  target/i386/emulate/x86_emu.h    |   8 +-
>  target/i386/emulate/x86_flags.h  |  12 +-
>  target/i386/emulate/x86_decode.c |  76 ++++++------
>  target/i386/emulate/x86_emu.c    | 125 +++++++++----------
>  target/i386/emulate/x86_flags.c  | 198 +++++++++++++------------------
>  7 files changed, 197 insertions(+), 237 deletions(-)
> 
> -- 
> 2.49.0
>
Re: [CFT PATCH 0/4] target/i386/emulate: cleanups
Posted by Paolo Bonzini 6 months, 2 weeks ago
Il sab 3 mag 2025, 07:39 Wei Liu <wei.liu@kernel.org> ha scritto:

> FWIW this series builds fine on for x86 HVF.
>

Thanks, can you also test it on either HVF or Hyper-V?

Paolo

Thanks,
> Wei.
>
> >
> > Paolo Bonzini (4):
> >   target/i386/emulate: fix target_ulong format strings
> >   target/i386/emulate: stop overloading decode->op[N].ptr
> >   target/i386/emulate: mostly rewrite flags handling
> >   target/i386: remove lflags
> >
> >  target/i386/cpu.h                |   6 -
> >  target/i386/emulate/x86_decode.h |   9 +-
> >  target/i386/emulate/x86_emu.h    |   8 +-
> >  target/i386/emulate/x86_flags.h  |  12 +-
> >  target/i386/emulate/x86_decode.c |  76 ++++++------
> >  target/i386/emulate/x86_emu.c    | 125 +++++++++----------
> >  target/i386/emulate/x86_flags.c  | 198 +++++++++++++------------------
> >  7 files changed, 197 insertions(+), 237 deletions(-)
> >
> > --
> > 2.49.0
> >
>
>
Re: [CFT PATCH 0/4] target/i386/emulate: cleanups
Posted by Wei Liu 6 months, 2 weeks ago
On Sat, May 03, 2025 at 09:01:46AM +0200, Paolo Bonzini wrote:
> Il sab 3 mag 2025, 07:39 Wei Liu <wei.liu@kernel.org> ha scritto:
> 
> > FWIW this series builds fine on for x86 HVF.
> >
> 
> Thanks, can you also test it on either HVF or Hyper-V?
> 

I will leave it to Magnus to test your changes on MSHV.

Wei.