i386: hvf: add code base from Google's QEMU repository
This file begins tracking the files that will be the code base for HVF
support in QEMU. This code base is part of Google's QEMU version of
their Android emulator, and can be found at
https://android.googlesource.com/platform/external/qemu/+/emu-master-dev
This code is based on Veertu Inc's vdhh (Veertu Desktop Hosted
Hypervisor), found at https://github.com/veertuinc/vdhh. Everything is
appropriately licensed under GPL v2-or-later, except for the code inside
x86_task.c and x86_task.h, which, deriving from KVM (the Linux kernel),
is licensed GPL v2-only.
This code base already implements a very great deal of functionality,
although Google's version removed from Vertuu's the support for APIC
page and hyperv-related stuff. According to the Android Emulator Release
Notes, Revision 26.1.3 (August 2017), "Hypervisor.framework is now
enabled by default on macOS for 32-bit x86 images to improve performance
and macOS compatibility", although we better use with caution for, as the
same Revision warns us, "If you experience issues with it specifically,
please file a bug report...". The code hasn't seen much update in the
last 5 months, so I think that we can further develop the code with
occasional visiting Google's repository to see if there has been any
update.
On top of Google's code, the following changes were made:
- add code to the configure script to support the --enable-hvf argument.
If the OS is Darwin, it checks for presence of HVF in the system. The
patch also adds strings related to HVF in the file qemu-options.hx.
QEMU will only support the modern syntax style '-M accel=hvf' no enable
hvf; the legacy '-enable-hvf' will not be supported.
- fix styling issues
- add glue code to cpus.c
- move HVFX86EmulatorState field to CPUX86State, changing the
the emulation functions to have a parameter with signature 'CPUX86State *'
instead of 'CPUState *' so we don't have to get the 'env'.
Signed-off-by: Sergio Andres Gomez Del Real <Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-2-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-3-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-5-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-6-Sergio.G.DelReal@gmail.com>
Message-Id: <20170905035457.3753-7-Sergio.G.DelReal@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-09-13 12:05:09 +03:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Veertu Inc,
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
2017-09-13 12:05:11 +03:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
i386: hvf: add code base from Google's QEMU repository
This file begins tracking the files that will be the code base for HVF
support in QEMU. This code base is part of Google's QEMU version of
their Android emulator, and can be found at
https://android.googlesource.com/platform/external/qemu/+/emu-master-dev
This code is based on Veertu Inc's vdhh (Veertu Desktop Hosted
Hypervisor), found at https://github.com/veertuinc/vdhh. Everything is
appropriately licensed under GPL v2-or-later, except for the code inside
x86_task.c and x86_task.h, which, deriving from KVM (the Linux kernel),
is licensed GPL v2-only.
This code base already implements a very great deal of functionality,
although Google's version removed from Vertuu's the support for APIC
page and hyperv-related stuff. According to the Android Emulator Release
Notes, Revision 26.1.3 (August 2017), "Hypervisor.framework is now
enabled by default on macOS for 32-bit x86 images to improve performance
and macOS compatibility", although we better use with caution for, as the
same Revision warns us, "If you experience issues with it specifically,
please file a bug report...". The code hasn't seen much update in the
last 5 months, so I think that we can further develop the code with
occasional visiting Google's repository to see if there has been any
update.
On top of Google's code, the following changes were made:
- add code to the configure script to support the --enable-hvf argument.
If the OS is Darwin, it checks for presence of HVF in the system. The
patch also adds strings related to HVF in the file qemu-options.hx.
QEMU will only support the modern syntax style '-M accel=hvf' no enable
hvf; the legacy '-enable-hvf' will not be supported.
- fix styling issues
- add glue code to cpus.c
- move HVFX86EmulatorState field to CPUX86State, changing the
the emulation functions to have a parameter with signature 'CPUX86State *'
instead of 'CPUState *' so we don't have to get the 'env'.
Signed-off-by: Sergio Andres Gomez Del Real <Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-2-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-3-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-5-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-6-Sergio.G.DelReal@gmail.com>
Message-Id: <20170905035457.3753-7-Sergio.G.DelReal@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-09-13 12:05:09 +03:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2017-09-13 12:05:11 +03:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
i386: hvf: add code base from Google's QEMU repository
This file begins tracking the files that will be the code base for HVF
support in QEMU. This code base is part of Google's QEMU version of
their Android emulator, and can be found at
https://android.googlesource.com/platform/external/qemu/+/emu-master-dev
This code is based on Veertu Inc's vdhh (Veertu Desktop Hosted
Hypervisor), found at https://github.com/veertuinc/vdhh. Everything is
appropriately licensed under GPL v2-or-later, except for the code inside
x86_task.c and x86_task.h, which, deriving from KVM (the Linux kernel),
is licensed GPL v2-only.
This code base already implements a very great deal of functionality,
although Google's version removed from Vertuu's the support for APIC
page and hyperv-related stuff. According to the Android Emulator Release
Notes, Revision 26.1.3 (August 2017), "Hypervisor.framework is now
enabled by default on macOS for 32-bit x86 images to improve performance
and macOS compatibility", although we better use with caution for, as the
same Revision warns us, "If you experience issues with it specifically,
please file a bug report...". The code hasn't seen much update in the
last 5 months, so I think that we can further develop the code with
occasional visiting Google's repository to see if there has been any
update.
On top of Google's code, the following changes were made:
- add code to the configure script to support the --enable-hvf argument.
If the OS is Darwin, it checks for presence of HVF in the system. The
patch also adds strings related to HVF in the file qemu-options.hx.
QEMU will only support the modern syntax style '-M accel=hvf' no enable
hvf; the legacy '-enable-hvf' will not be supported.
- fix styling issues
- add glue code to cpus.c
- move HVFX86EmulatorState field to CPUX86State, changing the
the emulation functions to have a parameter with signature 'CPUX86State *'
instead of 'CPUState *' so we don't have to get the 'env'.
Signed-off-by: Sergio Andres Gomez Del Real <Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-2-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-3-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-5-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-6-Sergio.G.DelReal@gmail.com>
Message-Id: <20170905035457.3753-7-Sergio.G.DelReal@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-09-13 12:05:09 +03:00
|
|
|
*
|
2017-09-13 12:05:11 +03:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
|
i386: hvf: add code base from Google's QEMU repository
This file begins tracking the files that will be the code base for HVF
support in QEMU. This code base is part of Google's QEMU version of
their Android emulator, and can be found at
https://android.googlesource.com/platform/external/qemu/+/emu-master-dev
This code is based on Veertu Inc's vdhh (Veertu Desktop Hosted
Hypervisor), found at https://github.com/veertuinc/vdhh. Everything is
appropriately licensed under GPL v2-or-later, except for the code inside
x86_task.c and x86_task.h, which, deriving from KVM (the Linux kernel),
is licensed GPL v2-only.
This code base already implements a very great deal of functionality,
although Google's version removed from Vertuu's the support for APIC
page and hyperv-related stuff. According to the Android Emulator Release
Notes, Revision 26.1.3 (August 2017), "Hypervisor.framework is now
enabled by default on macOS for 32-bit x86 images to improve performance
and macOS compatibility", although we better use with caution for, as the
same Revision warns us, "If you experience issues with it specifically,
please file a bug report...". The code hasn't seen much update in the
last 5 months, so I think that we can further develop the code with
occasional visiting Google's repository to see if there has been any
update.
On top of Google's code, the following changes were made:
- add code to the configure script to support the --enable-hvf argument.
If the OS is Darwin, it checks for presence of HVF in the system. The
patch also adds strings related to HVF in the file qemu-options.hx.
QEMU will only support the modern syntax style '-M accel=hvf' no enable
hvf; the legacy '-enable-hvf' will not be supported.
- fix styling issues
- add glue code to cpus.c
- move HVFX86EmulatorState field to CPUX86State, changing the
the emulation functions to have a parameter with signature 'CPUX86State *'
instead of 'CPUState *' so we don't have to get the 'env'.
Signed-off-by: Sergio Andres Gomez Del Real <Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-2-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-3-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-5-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-6-Sergio.G.DelReal@gmail.com>
Message-Id: <20170905035457.3753-7-Sergio.G.DelReal@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-09-13 12:05:09 +03:00
|
|
|
*/
|
|
|
|
|
2017-10-03 16:36:05 +03:00
|
|
|
#ifndef HVF_X86_DECODE_H
|
2019-03-15 17:51:22 +03:00
|
|
|
#define HVF_X86_DECODE_H
|
i386: hvf: add code base from Google's QEMU repository
This file begins tracking the files that will be the code base for HVF
support in QEMU. This code base is part of Google's QEMU version of
their Android emulator, and can be found at
https://android.googlesource.com/platform/external/qemu/+/emu-master-dev
This code is based on Veertu Inc's vdhh (Veertu Desktop Hosted
Hypervisor), found at https://github.com/veertuinc/vdhh. Everything is
appropriately licensed under GPL v2-or-later, except for the code inside
x86_task.c and x86_task.h, which, deriving from KVM (the Linux kernel),
is licensed GPL v2-only.
This code base already implements a very great deal of functionality,
although Google's version removed from Vertuu's the support for APIC
page and hyperv-related stuff. According to the Android Emulator Release
Notes, Revision 26.1.3 (August 2017), "Hypervisor.framework is now
enabled by default on macOS for 32-bit x86 images to improve performance
and macOS compatibility", although we better use with caution for, as the
same Revision warns us, "If you experience issues with it specifically,
please file a bug report...". The code hasn't seen much update in the
last 5 months, so I think that we can further develop the code with
occasional visiting Google's repository to see if there has been any
update.
On top of Google's code, the following changes were made:
- add code to the configure script to support the --enable-hvf argument.
If the OS is Darwin, it checks for presence of HVF in the system. The
patch also adds strings related to HVF in the file qemu-options.hx.
QEMU will only support the modern syntax style '-M accel=hvf' no enable
hvf; the legacy '-enable-hvf' will not be supported.
- fix styling issues
- add glue code to cpus.c
- move HVFX86EmulatorState field to CPUX86State, changing the
the emulation functions to have a parameter with signature 'CPUX86State *'
instead of 'CPUState *' so we don't have to get the 'env'.
Signed-off-by: Sergio Andres Gomez Del Real <Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-2-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-3-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-5-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-6-Sergio.G.DelReal@gmail.com>
Message-Id: <20170905035457.3753-7-Sergio.G.DelReal@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-09-13 12:05:09 +03:00
|
|
|
|
|
|
|
#include "cpu.h"
|
2017-10-03 16:36:05 +03:00
|
|
|
#include "x86.h"
|
i386: hvf: add code base from Google's QEMU repository
This file begins tracking the files that will be the code base for HVF
support in QEMU. This code base is part of Google's QEMU version of
their Android emulator, and can be found at
https://android.googlesource.com/platform/external/qemu/+/emu-master-dev
This code is based on Veertu Inc's vdhh (Veertu Desktop Hosted
Hypervisor), found at https://github.com/veertuinc/vdhh. Everything is
appropriately licensed under GPL v2-or-later, except for the code inside
x86_task.c and x86_task.h, which, deriving from KVM (the Linux kernel),
is licensed GPL v2-only.
This code base already implements a very great deal of functionality,
although Google's version removed from Vertuu's the support for APIC
page and hyperv-related stuff. According to the Android Emulator Release
Notes, Revision 26.1.3 (August 2017), "Hypervisor.framework is now
enabled by default on macOS for 32-bit x86 images to improve performance
and macOS compatibility", although we better use with caution for, as the
same Revision warns us, "If you experience issues with it specifically,
please file a bug report...". The code hasn't seen much update in the
last 5 months, so I think that we can further develop the code with
occasional visiting Google's repository to see if there has been any
update.
On top of Google's code, the following changes were made:
- add code to the configure script to support the --enable-hvf argument.
If the OS is Darwin, it checks for presence of HVF in the system. The
patch also adds strings related to HVF in the file qemu-options.hx.
QEMU will only support the modern syntax style '-M accel=hvf' no enable
hvf; the legacy '-enable-hvf' will not be supported.
- fix styling issues
- add glue code to cpus.c
- move HVFX86EmulatorState field to CPUX86State, changing the
the emulation functions to have a parameter with signature 'CPUX86State *'
instead of 'CPUState *' so we don't have to get the 'env'.
Signed-off-by: Sergio Andres Gomez Del Real <Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-2-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-3-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-5-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-6-Sergio.G.DelReal@gmail.com>
Message-Id: <20170905035457.3753-7-Sergio.G.DelReal@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-09-13 12:05:09 +03:00
|
|
|
|
|
|
|
typedef enum x86_prefix {
|
|
|
|
/* group 1 */
|
|
|
|
PREFIX_LOCK = 0xf0,
|
|
|
|
PREFIX_REPN = 0xf2,
|
|
|
|
PREFIX_REP = 0xf3,
|
|
|
|
/* group 2 */
|
2019-11-24 23:05:25 +03:00
|
|
|
PREFIX_CS_SEG_OVERRIDE = 0x2e,
|
|
|
|
PREFIX_SS_SEG_OVERRIDE = 0x36,
|
|
|
|
PREFIX_DS_SEG_OVERRIDE = 0x3e,
|
|
|
|
PREFIX_ES_SEG_OVERRIDE = 0x26,
|
|
|
|
PREFIX_FS_SEG_OVERRIDE = 0x64,
|
|
|
|
PREFIX_GS_SEG_OVERRIDE = 0x65,
|
i386: hvf: add code base from Google's QEMU repository
This file begins tracking the files that will be the code base for HVF
support in QEMU. This code base is part of Google's QEMU version of
their Android emulator, and can be found at
https://android.googlesource.com/platform/external/qemu/+/emu-master-dev
This code is based on Veertu Inc's vdhh (Veertu Desktop Hosted
Hypervisor), found at https://github.com/veertuinc/vdhh. Everything is
appropriately licensed under GPL v2-or-later, except for the code inside
x86_task.c and x86_task.h, which, deriving from KVM (the Linux kernel),
is licensed GPL v2-only.
This code base already implements a very great deal of functionality,
although Google's version removed from Vertuu's the support for APIC
page and hyperv-related stuff. According to the Android Emulator Release
Notes, Revision 26.1.3 (August 2017), "Hypervisor.framework is now
enabled by default on macOS for 32-bit x86 images to improve performance
and macOS compatibility", although we better use with caution for, as the
same Revision warns us, "If you experience issues with it specifically,
please file a bug report...". The code hasn't seen much update in the
last 5 months, so I think that we can further develop the code with
occasional visiting Google's repository to see if there has been any
update.
On top of Google's code, the following changes were made:
- add code to the configure script to support the --enable-hvf argument.
If the OS is Darwin, it checks for presence of HVF in the system. The
patch also adds strings related to HVF in the file qemu-options.hx.
QEMU will only support the modern syntax style '-M accel=hvf' no enable
hvf; the legacy '-enable-hvf' will not be supported.
- fix styling issues
- add glue code to cpus.c
- move HVFX86EmulatorState field to CPUX86State, changing the
the emulation functions to have a parameter with signature 'CPUX86State *'
instead of 'CPUState *' so we don't have to get the 'env'.
Signed-off-by: Sergio Andres Gomez Del Real <Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-2-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-3-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-5-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-6-Sergio.G.DelReal@gmail.com>
Message-Id: <20170905035457.3753-7-Sergio.G.DelReal@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-09-13 12:05:09 +03:00
|
|
|
/* group 3 */
|
|
|
|
PREFIX_OP_SIZE_OVERRIDE = 0x66,
|
|
|
|
/* group 4 */
|
|
|
|
PREFIX_ADDR_SIZE_OVERRIDE = 0x67,
|
|
|
|
|
|
|
|
PREFIX_REX = 0x40,
|
|
|
|
} x86_prefix;
|
|
|
|
|
|
|
|
enum x86_decode_cmd {
|
|
|
|
X86_DECODE_CMD_INVL = 0,
|
|
|
|
|
|
|
|
X86_DECODE_CMD_PUSH,
|
|
|
|
X86_DECODE_CMD_PUSH_SEG,
|
|
|
|
X86_DECODE_CMD_POP,
|
|
|
|
X86_DECODE_CMD_POP_SEG,
|
|
|
|
X86_DECODE_CMD_MOV,
|
|
|
|
X86_DECODE_CMD_MOVSX,
|
|
|
|
X86_DECODE_CMD_MOVZX,
|
|
|
|
X86_DECODE_CMD_CALL_NEAR,
|
|
|
|
X86_DECODE_CMD_CALL_NEAR_ABS_INDIRECT,
|
|
|
|
X86_DECODE_CMD_CALL_FAR_ABS_INDIRECT,
|
|
|
|
X86_DECODE_CMD_CALL_FAR,
|
|
|
|
X86_DECODE_RET_NEAR,
|
|
|
|
X86_DECODE_RET_FAR,
|
|
|
|
X86_DECODE_CMD_ADD,
|
|
|
|
X86_DECODE_CMD_OR,
|
|
|
|
X86_DECODE_CMD_ADC,
|
|
|
|
X86_DECODE_CMD_SBB,
|
|
|
|
X86_DECODE_CMD_AND,
|
|
|
|
X86_DECODE_CMD_SUB,
|
|
|
|
X86_DECODE_CMD_XOR,
|
|
|
|
X86_DECODE_CMD_CMP,
|
|
|
|
X86_DECODE_CMD_INC,
|
|
|
|
X86_DECODE_CMD_DEC,
|
|
|
|
X86_DECODE_CMD_TST,
|
|
|
|
X86_DECODE_CMD_NOT,
|
|
|
|
X86_DECODE_CMD_NEG,
|
|
|
|
X86_DECODE_CMD_JMP_NEAR,
|
|
|
|
X86_DECODE_CMD_JMP_NEAR_ABS_INDIRECT,
|
|
|
|
X86_DECODE_CMD_JMP_FAR,
|
|
|
|
X86_DECODE_CMD_JMP_FAR_ABS_INDIRECT,
|
|
|
|
X86_DECODE_CMD_LEA,
|
|
|
|
X86_DECODE_CMD_JXX,
|
|
|
|
X86_DECODE_CMD_JCXZ,
|
|
|
|
X86_DECODE_CMD_SETXX,
|
|
|
|
X86_DECODE_CMD_MOV_TO_SEG,
|
|
|
|
X86_DECODE_CMD_MOV_FROM_SEG,
|
|
|
|
X86_DECODE_CMD_CLI,
|
|
|
|
X86_DECODE_CMD_STI,
|
|
|
|
X86_DECODE_CMD_CLD,
|
|
|
|
X86_DECODE_CMD_STD,
|
|
|
|
X86_DECODE_CMD_STC,
|
|
|
|
X86_DECODE_CMD_CLC,
|
|
|
|
X86_DECODE_CMD_OUT,
|
|
|
|
X86_DECODE_CMD_IN,
|
|
|
|
X86_DECODE_CMD_INS,
|
|
|
|
X86_DECODE_CMD_OUTS,
|
|
|
|
X86_DECODE_CMD_LIDT,
|
|
|
|
X86_DECODE_CMD_SIDT,
|
|
|
|
X86_DECODE_CMD_LGDT,
|
|
|
|
X86_DECODE_CMD_SGDT,
|
|
|
|
X86_DECODE_CMD_SMSW,
|
|
|
|
X86_DECODE_CMD_LMSW,
|
|
|
|
X86_DECODE_CMD_RDTSCP,
|
|
|
|
X86_DECODE_CMD_INVLPG,
|
|
|
|
X86_DECODE_CMD_MOV_TO_CR,
|
|
|
|
X86_DECODE_CMD_MOV_FROM_CR,
|
|
|
|
X86_DECODE_CMD_MOV_TO_DR,
|
|
|
|
X86_DECODE_CMD_MOV_FROM_DR,
|
|
|
|
X86_DECODE_CMD_PUSHF,
|
|
|
|
X86_DECODE_CMD_POPF,
|
|
|
|
X86_DECODE_CMD_CPUID,
|
|
|
|
X86_DECODE_CMD_ROL,
|
|
|
|
X86_DECODE_CMD_ROR,
|
|
|
|
X86_DECODE_CMD_RCL,
|
|
|
|
X86_DECODE_CMD_RCR,
|
|
|
|
X86_DECODE_CMD_SHL,
|
|
|
|
X86_DECODE_CMD_SAL,
|
|
|
|
X86_DECODE_CMD_SHR,
|
|
|
|
X86_DECODE_CMD_SHRD,
|
|
|
|
X86_DECODE_CMD_SHLD,
|
|
|
|
X86_DECODE_CMD_SAR,
|
|
|
|
X86_DECODE_CMD_DIV,
|
|
|
|
X86_DECODE_CMD_IDIV,
|
|
|
|
X86_DECODE_CMD_MUL,
|
|
|
|
X86_DECODE_CMD_IMUL_3,
|
|
|
|
X86_DECODE_CMD_IMUL_2,
|
|
|
|
X86_DECODE_CMD_IMUL_1,
|
|
|
|
X86_DECODE_CMD_MOVS,
|
|
|
|
X86_DECODE_CMD_CMPS,
|
|
|
|
X86_DECODE_CMD_SCAS,
|
|
|
|
X86_DECODE_CMD_LODS,
|
|
|
|
X86_DECODE_CMD_STOS,
|
|
|
|
X86_DECODE_CMD_BSWAP,
|
|
|
|
X86_DECODE_CMD_XCHG,
|
|
|
|
X86_DECODE_CMD_RDTSC,
|
|
|
|
X86_DECODE_CMD_RDMSR,
|
|
|
|
X86_DECODE_CMD_WRMSR,
|
|
|
|
X86_DECODE_CMD_ENTER,
|
|
|
|
X86_DECODE_CMD_LEAVE,
|
|
|
|
X86_DECODE_CMD_BT,
|
|
|
|
X86_DECODE_CMD_BTS,
|
|
|
|
X86_DECODE_CMD_BTC,
|
|
|
|
X86_DECODE_CMD_BTR,
|
|
|
|
X86_DECODE_CMD_BSF,
|
|
|
|
X86_DECODE_CMD_BSR,
|
|
|
|
X86_DECODE_CMD_IRET,
|
|
|
|
X86_DECODE_CMD_INT,
|
|
|
|
X86_DECODE_CMD_POPA,
|
|
|
|
X86_DECODE_CMD_PUSHA,
|
|
|
|
X86_DECODE_CMD_CWD,
|
|
|
|
X86_DECODE_CMD_CBW,
|
|
|
|
X86_DECODE_CMD_DAS,
|
|
|
|
X86_DECODE_CMD_AAD,
|
|
|
|
X86_DECODE_CMD_AAM,
|
|
|
|
X86_DECODE_CMD_AAS,
|
|
|
|
X86_DECODE_CMD_LOOP,
|
|
|
|
X86_DECODE_CMD_SLDT,
|
|
|
|
X86_DECODE_CMD_STR,
|
|
|
|
X86_DECODE_CMD_LLDT,
|
|
|
|
X86_DECODE_CMD_LTR,
|
|
|
|
X86_DECODE_CMD_VERR,
|
|
|
|
X86_DECODE_CMD_VERW,
|
|
|
|
X86_DECODE_CMD_SAHF,
|
|
|
|
X86_DECODE_CMD_LAHF,
|
|
|
|
X86_DECODE_CMD_WBINVD,
|
|
|
|
X86_DECODE_CMD_LDS,
|
|
|
|
X86_DECODE_CMD_LSS,
|
|
|
|
X86_DECODE_CMD_LES,
|
|
|
|
X86_DECODE_XMD_LGS,
|
|
|
|
X86_DECODE_CMD_LFS,
|
|
|
|
X86_DECODE_CMD_CMC,
|
|
|
|
X86_DECODE_CMD_XLAT,
|
|
|
|
X86_DECODE_CMD_NOP,
|
|
|
|
X86_DECODE_CMD_CMOV,
|
|
|
|
X86_DECODE_CMD_CLTS,
|
|
|
|
X86_DECODE_CMD_XADD,
|
|
|
|
X86_DECODE_CMD_HLT,
|
|
|
|
X86_DECODE_CMD_CMPXCHG8B,
|
|
|
|
X86_DECODE_CMD_CMPXCHG,
|
|
|
|
X86_DECODE_CMD_POPCNT,
|
|
|
|
|
|
|
|
X86_DECODE_CMD_FNINIT,
|
|
|
|
X86_DECODE_CMD_FLD,
|
|
|
|
X86_DECODE_CMD_FLDxx,
|
|
|
|
X86_DECODE_CMD_FNSTCW,
|
|
|
|
X86_DECODE_CMD_FNSTSW,
|
|
|
|
X86_DECODE_CMD_FNSETPM,
|
|
|
|
X86_DECODE_CMD_FSAVE,
|
|
|
|
X86_DECODE_CMD_FRSTOR,
|
|
|
|
X86_DECODE_CMD_FXSAVE,
|
|
|
|
X86_DECODE_CMD_FXRSTOR,
|
|
|
|
X86_DECODE_CMD_FDIV,
|
|
|
|
X86_DECODE_CMD_FMUL,
|
|
|
|
X86_DECODE_CMD_FSUB,
|
|
|
|
X86_DECODE_CMD_FADD,
|
|
|
|
X86_DECODE_CMD_EMMS,
|
|
|
|
X86_DECODE_CMD_MFENCE,
|
|
|
|
X86_DECODE_CMD_SFENCE,
|
|
|
|
X86_DECODE_CMD_LFENCE,
|
|
|
|
X86_DECODE_CMD_PREFETCH,
|
|
|
|
X86_DECODE_CMD_CLFLUSH,
|
|
|
|
X86_DECODE_CMD_FST,
|
|
|
|
X86_DECODE_CMD_FABS,
|
|
|
|
X86_DECODE_CMD_FUCOM,
|
|
|
|
X86_DECODE_CMD_FUCOMI,
|
|
|
|
X86_DECODE_CMD_FLDCW,
|
|
|
|
X86_DECODE_CMD_FXCH,
|
|
|
|
X86_DECODE_CMD_FCHS,
|
|
|
|
X86_DECODE_CMD_FCMOV,
|
|
|
|
X86_DECODE_CMD_FRNDINT,
|
|
|
|
X86_DECODE_CMD_FXAM,
|
|
|
|
|
|
|
|
X86_DECODE_CMD_LAST,
|
|
|
|
};
|
|
|
|
|
|
|
|
const char *decode_cmd_to_string(enum x86_decode_cmd cmd);
|
|
|
|
|
|
|
|
typedef struct x86_modrm {
|
|
|
|
union {
|
|
|
|
uint8_t modrm;
|
|
|
|
struct {
|
|
|
|
uint8_t rm:3;
|
|
|
|
uint8_t reg:3;
|
|
|
|
uint8_t mod:2;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} __attribute__ ((__packed__)) x86_modrm;
|
|
|
|
|
|
|
|
typedef struct x86_sib {
|
|
|
|
union {
|
|
|
|
uint8_t sib;
|
|
|
|
struct {
|
|
|
|
uint8_t base:3;
|
|
|
|
uint8_t index:3;
|
|
|
|
uint8_t scale:2;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} __attribute__ ((__packed__)) x86_sib;
|
|
|
|
|
|
|
|
typedef struct x86_rex {
|
|
|
|
union {
|
|
|
|
uint8_t rex;
|
|
|
|
struct {
|
|
|
|
uint8_t b:1;
|
|
|
|
uint8_t x:1;
|
|
|
|
uint8_t r:1;
|
|
|
|
uint8_t w:1;
|
|
|
|
uint8_t unused:4;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} __attribute__ ((__packed__)) x86_rex;
|
|
|
|
|
|
|
|
typedef enum x86_var_type {
|
|
|
|
X86_VAR_IMMEDIATE,
|
|
|
|
X86_VAR_OFFSET,
|
|
|
|
X86_VAR_REG,
|
|
|
|
X86_VAR_RM,
|
|
|
|
|
|
|
|
/* for floating point computations */
|
|
|
|
X87_VAR_REG,
|
|
|
|
X87_VAR_FLOATP,
|
|
|
|
X87_VAR_INTP,
|
|
|
|
X87_VAR_BYTEP,
|
|
|
|
} x86_var_type;
|
|
|
|
|
|
|
|
typedef struct x86_decode_op {
|
|
|
|
enum x86_var_type type;
|
|
|
|
int size;
|
|
|
|
|
|
|
|
int reg;
|
2017-10-03 16:17:37 +03:00
|
|
|
target_ulong val;
|
i386: hvf: add code base from Google's QEMU repository
This file begins tracking the files that will be the code base for HVF
support in QEMU. This code base is part of Google's QEMU version of
their Android emulator, and can be found at
https://android.googlesource.com/platform/external/qemu/+/emu-master-dev
This code is based on Veertu Inc's vdhh (Veertu Desktop Hosted
Hypervisor), found at https://github.com/veertuinc/vdhh. Everything is
appropriately licensed under GPL v2-or-later, except for the code inside
x86_task.c and x86_task.h, which, deriving from KVM (the Linux kernel),
is licensed GPL v2-only.
This code base already implements a very great deal of functionality,
although Google's version removed from Vertuu's the support for APIC
page and hyperv-related stuff. According to the Android Emulator Release
Notes, Revision 26.1.3 (August 2017), "Hypervisor.framework is now
enabled by default on macOS for 32-bit x86 images to improve performance
and macOS compatibility", although we better use with caution for, as the
same Revision warns us, "If you experience issues with it specifically,
please file a bug report...". The code hasn't seen much update in the
last 5 months, so I think that we can further develop the code with
occasional visiting Google's repository to see if there has been any
update.
On top of Google's code, the following changes were made:
- add code to the configure script to support the --enable-hvf argument.
If the OS is Darwin, it checks for presence of HVF in the system. The
patch also adds strings related to HVF in the file qemu-options.hx.
QEMU will only support the modern syntax style '-M accel=hvf' no enable
hvf; the legacy '-enable-hvf' will not be supported.
- fix styling issues
- add glue code to cpus.c
- move HVFX86EmulatorState field to CPUX86State, changing the
the emulation functions to have a parameter with signature 'CPUX86State *'
instead of 'CPUState *' so we don't have to get the 'env'.
Signed-off-by: Sergio Andres Gomez Del Real <Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-2-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-3-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-5-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-6-Sergio.G.DelReal@gmail.com>
Message-Id: <20170905035457.3753-7-Sergio.G.DelReal@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-09-13 12:05:09 +03:00
|
|
|
|
2017-10-03 16:17:37 +03:00
|
|
|
target_ulong ptr;
|
i386: hvf: add code base from Google's QEMU repository
This file begins tracking the files that will be the code base for HVF
support in QEMU. This code base is part of Google's QEMU version of
their Android emulator, and can be found at
https://android.googlesource.com/platform/external/qemu/+/emu-master-dev
This code is based on Veertu Inc's vdhh (Veertu Desktop Hosted
Hypervisor), found at https://github.com/veertuinc/vdhh. Everything is
appropriately licensed under GPL v2-or-later, except for the code inside
x86_task.c and x86_task.h, which, deriving from KVM (the Linux kernel),
is licensed GPL v2-only.
This code base already implements a very great deal of functionality,
although Google's version removed from Vertuu's the support for APIC
page and hyperv-related stuff. According to the Android Emulator Release
Notes, Revision 26.1.3 (August 2017), "Hypervisor.framework is now
enabled by default on macOS for 32-bit x86 images to improve performance
and macOS compatibility", although we better use with caution for, as the
same Revision warns us, "If you experience issues with it specifically,
please file a bug report...". The code hasn't seen much update in the
last 5 months, so I think that we can further develop the code with
occasional visiting Google's repository to see if there has been any
update.
On top of Google's code, the following changes were made:
- add code to the configure script to support the --enable-hvf argument.
If the OS is Darwin, it checks for presence of HVF in the system. The
patch also adds strings related to HVF in the file qemu-options.hx.
QEMU will only support the modern syntax style '-M accel=hvf' no enable
hvf; the legacy '-enable-hvf' will not be supported.
- fix styling issues
- add glue code to cpus.c
- move HVFX86EmulatorState field to CPUX86State, changing the
the emulation functions to have a parameter with signature 'CPUX86State *'
instead of 'CPUState *' so we don't have to get the 'env'.
Signed-off-by: Sergio Andres Gomez Del Real <Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-2-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-3-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-5-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-6-Sergio.G.DelReal@gmail.com>
Message-Id: <20170905035457.3753-7-Sergio.G.DelReal@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-09-13 12:05:09 +03:00
|
|
|
} x86_decode_op;
|
|
|
|
|
|
|
|
typedef struct x86_decode {
|
|
|
|
int len;
|
|
|
|
uint8_t opcode[4];
|
|
|
|
uint8_t opcode_len;
|
|
|
|
enum x86_decode_cmd cmd;
|
|
|
|
int addressing_size;
|
|
|
|
int operand_size;
|
|
|
|
int lock;
|
|
|
|
int rep;
|
|
|
|
int op_size_override;
|
|
|
|
int addr_size_override;
|
|
|
|
int segment_override;
|
|
|
|
int control_change_inst;
|
|
|
|
bool fwait;
|
|
|
|
bool fpop_stack;
|
|
|
|
bool frev;
|
|
|
|
|
|
|
|
uint32_t displacement;
|
|
|
|
uint8_t displacement_size;
|
|
|
|
struct x86_rex rex;
|
|
|
|
bool is_modrm;
|
|
|
|
bool sib_present;
|
|
|
|
struct x86_sib sib;
|
|
|
|
struct x86_modrm modrm;
|
|
|
|
struct x86_decode_op op[4];
|
|
|
|
bool is_fpu;
|
2017-10-03 16:17:37 +03:00
|
|
|
uint32_t flags_mask;
|
i386: hvf: add code base from Google's QEMU repository
This file begins tracking the files that will be the code base for HVF
support in QEMU. This code base is part of Google's QEMU version of
their Android emulator, and can be found at
https://android.googlesource.com/platform/external/qemu/+/emu-master-dev
This code is based on Veertu Inc's vdhh (Veertu Desktop Hosted
Hypervisor), found at https://github.com/veertuinc/vdhh. Everything is
appropriately licensed under GPL v2-or-later, except for the code inside
x86_task.c and x86_task.h, which, deriving from KVM (the Linux kernel),
is licensed GPL v2-only.
This code base already implements a very great deal of functionality,
although Google's version removed from Vertuu's the support for APIC
page and hyperv-related stuff. According to the Android Emulator Release
Notes, Revision 26.1.3 (August 2017), "Hypervisor.framework is now
enabled by default on macOS for 32-bit x86 images to improve performance
and macOS compatibility", although we better use with caution for, as the
same Revision warns us, "If you experience issues with it specifically,
please file a bug report...". The code hasn't seen much update in the
last 5 months, so I think that we can further develop the code with
occasional visiting Google's repository to see if there has been any
update.
On top of Google's code, the following changes were made:
- add code to the configure script to support the --enable-hvf argument.
If the OS is Darwin, it checks for presence of HVF in the system. The
patch also adds strings related to HVF in the file qemu-options.hx.
QEMU will only support the modern syntax style '-M accel=hvf' no enable
hvf; the legacy '-enable-hvf' will not be supported.
- fix styling issues
- add glue code to cpus.c
- move HVFX86EmulatorState field to CPUX86State, changing the
the emulation functions to have a parameter with signature 'CPUX86State *'
instead of 'CPUState *' so we don't have to get the 'env'.
Signed-off-by: Sergio Andres Gomez Del Real <Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-2-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-3-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-5-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-6-Sergio.G.DelReal@gmail.com>
Message-Id: <20170905035457.3753-7-Sergio.G.DelReal@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-09-13 12:05:09 +03:00
|
|
|
|
|
|
|
} x86_decode;
|
|
|
|
|
|
|
|
uint64_t sign(uint64_t val, int size);
|
|
|
|
|
|
|
|
uint32_t decode_instruction(CPUX86State *env, struct x86_decode *decode);
|
|
|
|
|
2019-11-24 23:05:25 +03:00
|
|
|
target_ulong get_reg_ref(CPUX86State *env, int reg, int rex_present,
|
|
|
|
int is_extended, int size);
|
|
|
|
target_ulong get_reg_val(CPUX86State *env, int reg, int rex_present,
|
|
|
|
int is_extended, int size);
|
i386: hvf: add code base from Google's QEMU repository
This file begins tracking the files that will be the code base for HVF
support in QEMU. This code base is part of Google's QEMU version of
their Android emulator, and can be found at
https://android.googlesource.com/platform/external/qemu/+/emu-master-dev
This code is based on Veertu Inc's vdhh (Veertu Desktop Hosted
Hypervisor), found at https://github.com/veertuinc/vdhh. Everything is
appropriately licensed under GPL v2-or-later, except for the code inside
x86_task.c and x86_task.h, which, deriving from KVM (the Linux kernel),
is licensed GPL v2-only.
This code base already implements a very great deal of functionality,
although Google's version removed from Vertuu's the support for APIC
page and hyperv-related stuff. According to the Android Emulator Release
Notes, Revision 26.1.3 (August 2017), "Hypervisor.framework is now
enabled by default on macOS for 32-bit x86 images to improve performance
and macOS compatibility", although we better use with caution for, as the
same Revision warns us, "If you experience issues with it specifically,
please file a bug report...". The code hasn't seen much update in the
last 5 months, so I think that we can further develop the code with
occasional visiting Google's repository to see if there has been any
update.
On top of Google's code, the following changes were made:
- add code to the configure script to support the --enable-hvf argument.
If the OS is Darwin, it checks for presence of HVF in the system. The
patch also adds strings related to HVF in the file qemu-options.hx.
QEMU will only support the modern syntax style '-M accel=hvf' no enable
hvf; the legacy '-enable-hvf' will not be supported.
- fix styling issues
- add glue code to cpus.c
- move HVFX86EmulatorState field to CPUX86State, changing the
the emulation functions to have a parameter with signature 'CPUX86State *'
instead of 'CPUState *' so we don't have to get the 'env'.
Signed-off-by: Sergio Andres Gomez Del Real <Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-2-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-3-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-5-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-6-Sergio.G.DelReal@gmail.com>
Message-Id: <20170905035457.3753-7-Sergio.G.DelReal@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-09-13 12:05:09 +03:00
|
|
|
void calc_modrm_operand(CPUX86State *env, struct x86_decode *decode,
|
|
|
|
struct x86_decode_op *op);
|
2017-10-03 16:17:37 +03:00
|
|
|
target_ulong decode_linear_addr(CPUX86State *env, struct x86_decode *decode,
|
|
|
|
target_ulong addr, enum X86Seg seg);
|
i386: hvf: add code base from Google's QEMU repository
This file begins tracking the files that will be the code base for HVF
support in QEMU. This code base is part of Google's QEMU version of
their Android emulator, and can be found at
https://android.googlesource.com/platform/external/qemu/+/emu-master-dev
This code is based on Veertu Inc's vdhh (Veertu Desktop Hosted
Hypervisor), found at https://github.com/veertuinc/vdhh. Everything is
appropriately licensed under GPL v2-or-later, except for the code inside
x86_task.c and x86_task.h, which, deriving from KVM (the Linux kernel),
is licensed GPL v2-only.
This code base already implements a very great deal of functionality,
although Google's version removed from Vertuu's the support for APIC
page and hyperv-related stuff. According to the Android Emulator Release
Notes, Revision 26.1.3 (August 2017), "Hypervisor.framework is now
enabled by default on macOS for 32-bit x86 images to improve performance
and macOS compatibility", although we better use with caution for, as the
same Revision warns us, "If you experience issues with it specifically,
please file a bug report...". The code hasn't seen much update in the
last 5 months, so I think that we can further develop the code with
occasional visiting Google's repository to see if there has been any
update.
On top of Google's code, the following changes were made:
- add code to the configure script to support the --enable-hvf argument.
If the OS is Darwin, it checks for presence of HVF in the system. The
patch also adds strings related to HVF in the file qemu-options.hx.
QEMU will only support the modern syntax style '-M accel=hvf' no enable
hvf; the legacy '-enable-hvf' will not be supported.
- fix styling issues
- add glue code to cpus.c
- move HVFX86EmulatorState field to CPUX86State, changing the
the emulation functions to have a parameter with signature 'CPUX86State *'
instead of 'CPUState *' so we don't have to get the 'env'.
Signed-off-by: Sergio Andres Gomez Del Real <Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-2-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-3-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-5-Sergio.G.DelReal@gmail.com>
Message-Id: <20170913090522.4022-6-Sergio.G.DelReal@gmail.com>
Message-Id: <20170905035457.3753-7-Sergio.G.DelReal@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-09-13 12:05:09 +03:00
|
|
|
|
|
|
|
void init_decoder(void);
|
|
|
|
void calc_modrm_operand16(CPUX86State *env, struct x86_decode *decode,
|
|
|
|
struct x86_decode_op *op);
|
|
|
|
void calc_modrm_operand32(CPUX86State *env, struct x86_decode *decode,
|
|
|
|
struct x86_decode_op *op);
|
|
|
|
void calc_modrm_operand64(CPUX86State *env, struct x86_decode *decode,
|
|
|
|
struct x86_decode_op *op);
|
|
|
|
void set_addressing_size(CPUX86State *env, struct x86_decode *decode);
|
|
|
|
void set_operand_size(CPUX86State *env, struct x86_decode *decode);
|
2017-10-03 16:36:05 +03:00
|
|
|
|
|
|
|
#endif
|