#
f7a9f178 |
| 15-Jul-2014 |
Neel Natu <neel@FreeBSD.org> |
Add support for operand size and address size override prefixes in bhyve's instruction emulation [1].
Fix bug in emulation of opcode 0x8A where the destination is a legacy high byte register and the
Add support for operand size and address size override prefixes in bhyve's instruction emulation [1].
Fix bug in emulation of opcode 0x8A where the destination is a legacy high byte register and the guest vcpu is in 32-bit mode. Prior to this change instead of modifying %ah, %bh, %ch or %dh the emulation would end up modifying %spl, %bpl, %sil or %dil instead.
Add support for moffsets by treating it as a 2, 4 or 8 byte immediate value during instruction decoding.
Fix bug in verify_gla() where the linear address computed after decoding the instruction was not being truncated to the effective address size [2].
Tested by: Leon Dang [1] Reported by: Peter Grehan [2] Sponsored by: Nahanni Systems
show more ...
|
Revision tags: release/9.3.0 |
|
#
6cec9cad |
| 03-Jun-2014 |
Peter Grehan <grehan@FreeBSD.org> |
MFC @ r266724
An SVM update will follow this.
|
#
65ffa035 |
| 27-May-2014 |
Neel Natu <neel@FreeBSD.org> |
Add segment protection and limits violation checks in vie_calculate_gla() for 32-bit x86 guests.
Tested using ins/outs executed in a FreeBSD/i386 guest.
|
#
5382c19d |
| 25-May-2014 |
Neel Natu <neel@FreeBSD.org> |
Do the linear address calculation for the ins/outs emulation using a new API function 'vie_calculate_gla()'.
While the current implementation is simplistic it forms the basis of doing segmentation c
Do the linear address calculation for the ins/outs emulation using a new API function 'vie_calculate_gla()'.
While the current implementation is simplistic it forms the basis of doing segmentation checks if the guest is in 32-bit protected mode.
show more ...
|
#
e813a873 |
| 24-May-2014 |
Neel Natu <neel@FreeBSD.org> |
Consolidate all the information needed by the guest page table walker into 'struct vm_guest_paging'.
Check for canonical addressing in vmm_gla2gpa() and inject a protection fault into the guest if a
Consolidate all the information needed by the guest page table walker into 'struct vm_guest_paging'.
Check for canonical addressing in vmm_gla2gpa() and inject a protection fault into the guest if a violation is detected.
If the page table walk is restarted in vmm_gla2gpa() then reset 'ptpphys' to point to the root of the page tables.
show more ...
|
#
a7424861 |
| 23-May-2014 |
Neel Natu <neel@FreeBSD.org> |
Check for alignment check violation when processing in/out string instructions.
|
#
d17b5104 |
| 23-May-2014 |
Neel Natu <neel@FreeBSD.org> |
Add emulation of the "outsb" instruction. NetBSD guests use this to write to the UART FIFO.
The emulation is constrained in a number of ways: 64-bit only, doesn't check for all exception conditions,
Add emulation of the "outsb" instruction. NetBSD guests use this to write to the UART FIFO.
The emulation is constrained in a number of ways: 64-bit only, doesn't check for all exception conditions, limited to i/o ports emulated in userspace.
Some of these constraints will be relaxed in followup commits.
Requested by: grehan Reviewed by: tychon (partially and a much earlier version)
show more ...
|
#
fd949af6 |
| 22-May-2014 |
Neel Natu <neel@FreeBSD.org> |
Inject page fault into the guest if the page table walker detects an invalid translation for the guest linear address.
|
#
414fdaf0 |
| 21-May-2014 |
Alan Somers <asomers@FreeBSD.org> |
IFC @266473
|
#
e4c8a13d |
| 19-May-2014 |
Neel Natu <neel@FreeBSD.org> |
Add PG_U (user/supervisor) checks when translating a guest linear address to a guest physical address.
PG_PS (page size) field is valid only in a PDE or a PDPTE so it is now checked only in non-term
Add PG_U (user/supervisor) checks when translating a guest linear address to a guest physical address.
PG_PS (page size) field is valid only in a PDE or a PDPTE so it is now checked only in non-terminal paging entries.
Ignore the upper 32-bits of the CR3 for PAE paging.
show more ...
|
#
3b8f0845 |
| 28-Apr-2014 |
Simon J. Gerraty <sjg@FreeBSD.org> |
Merge head
|
#
84e51a1b |
| 23-Apr-2014 |
Alan Somers <asomers@FreeBSD.org> |
IFC @264767
|
#
c98bb15d |
| 21-Feb-2014 |
Glen Barber <gjb@FreeBSD.org> |
MFH: tracking commit
Sponsored by: The FreeBSD Foundation
|
#
5748b897 |
| 19-Feb-2014 |
Martin Matuska <mm@FreeBSD.org> |
Merge head up to r262222 (last merge was incomplete).
|
#
00f3efe1 |
| 05-Feb-2014 |
John Baldwin <jhb@FreeBSD.org> |
Add support for FreeBSD/i386 guests under bhyve. - Similar to the hack for bootinfo32.c in userboot, define _MACHINE_ELF_WANT_32BIT in the load_elf32 file handlers in userboot. This allows userbo
Add support for FreeBSD/i386 guests under bhyve. - Similar to the hack for bootinfo32.c in userboot, define _MACHINE_ELF_WANT_32BIT in the load_elf32 file handlers in userboot. This allows userboot to load 32-bit kernels and modules. - Copy the SMAP generation code out of bootinfo64.c and into its own file so it can be shared with bootinfo32.c to pass an SMAP to the i386 kernel. - Use uint32_t instead of u_long when aligning module metadata in bootinfo32.c in userboot, as otherwise the metadata used 64-bit alignment which corrupted the layout. - Populate the basemem and extmem members of the bootinfo struct passed to 32-bit kernels. - Fix the 32-bit stack in userboot to start at the top of the stack instead of the bottom so that there is room to grow before the kernel switches to its own stack. - Push a fake return address onto the 32-bit stack in addition to the arguments normally passed to exec() in the loader. This return address is needed to convince recover_bootinfo() in the 32-bit locore code that it is being invoked from a "new" boot block. - Add a routine to libvmmapi to setup a 32-bit flat mode register state including a GDT and TSS that is able to start the i386 kernel and update bhyveload to use it when booting an i386 kernel. - Use the guest register state to determine the CPU's current instruction mode (32-bit vs 64-bit) and paging mode (flat, 32-bit, PAE, or long mode) in the instruction emulation code. Update the gla2gpa() routine used when fetching instructions to handle flat mode, 32-bit paging, and PAE paging in addition to long mode paging. Don't look for a REX prefix when the CPU is in 32-bit mode, and use the detected mode to enable the existing 32-bit mode code when decoding the mod r/m byte.
Reviewed by: grehan, neel MFC after: 1 month
show more ...
|
Revision tags: release/10.0.0 |
|
#
d8ced945 |
| 18-Dec-2013 |
Peter Grehan <grehan@FreeBSD.org> |
MFC @ r256071
This is the change where the bhyve_npt_pmap branch was merged in to head.
The SVM changes to work with this will be in a follow-on submit.
|
#
0bfd163f |
| 18-Oct-2013 |
Gleb Smirnoff <glebius@FreeBSD.org> |
Merge head r233826 through r256722.
|
#
3caf0790 |
| 13-Oct-2013 |
Simon J. Gerraty <sjg@FreeBSD.org> |
Merge head@256284
|
#
1ccca3b5 |
| 10-Oct-2013 |
Alan Somers <asomers@FreeBSD.org> |
IFC @256277
Approved by: ken (mentor)
|
#
12babbf2 |
| 06-Oct-2013 |
Mark Murray <markm@FreeBSD.org> |
MFC - tracking commit
|
#
318224bb |
| 05-Oct-2013 |
Neel Natu <neel@FreeBSD.org> |
Merge projects/bhyve_npt_pmap into head.
Make the amd64/pmap code aware of nested page table mappings used by bhyve guests. This allows bhyve to associate each guest with its own vmspace and deal wi
Merge projects/bhyve_npt_pmap into head.
Make the amd64/pmap code aware of nested page table mappings used by bhyve guests. This allows bhyve to associate each guest with its own vmspace and deal with nested page faults in the context of that vmspace. This also enables features like accessed/dirty bit tracking, swapping to disk and transparent superpage promotions of guest memory.
Guest vmspace: Each bhyve guest has a unique vmspace to represent the physical memory allocated to the guest. Each memory segment allocated by the guest is mapped into the guest's address space via the 'vmspace->vm_map' and is backed by an object of type OBJT_DEFAULT.
pmap types: The amd64/pmap now understands two types of pmaps: PT_X86 and PT_EPT.
The PT_X86 pmap type is used by the vmspace associated with the host kernel as well as user processes executing on the host. The PT_EPT pmap is used by the vmspace associated with a bhyve guest.
Page Table Entries: The EPT page table entries as mostly similar in functionality to regular page table entries although there are some differences in terms of what bits are used to express that functionality. For e.g. the dirty bit is represented by bit 9 in the nested PTE as opposed to bit 6 in the regular x86 PTE. Therefore the bitmask representing the dirty bit is now computed at runtime based on the type of the pmap. Thus PG_M that was previously a macro now becomes a local variable that is initialized at runtime using 'pmap_modified_bit(pmap)'.
An additional wrinkle associated with EPT mappings is that older Intel processors don't have hardware support for tracking accessed/dirty bits in the PTE. This means that the amd64/pmap code needs to emulate these bits to provide proper accounting to the VM subsystem. This is achieved by using the following mapping for EPT entries that need emulation of A/D bits: Bit Position Interpreted By PG_V 52 software (accessed bit emulation handler) PG_RW 53 software (dirty bit emulation handler) PG_A 0 hardware (aka EPT_PG_RD) PG_M 1 hardware (aka EPT_PG_WR)
The idea to use the mapping listed above for A/D bit emulation came from Alan Cox (alc@).
The final difference with respect to x86 PTEs is that some EPT implementations do not support superpage mappings. This is recorded in the 'pm_flags' field of the pmap.
TLB invalidation: The amd64/pmap code has a number of ways to do invalidation of mappings that may be cached in the TLB: single page, multiple pages in a range or the entire TLB. All of these funnel into a single EPT invalidation routine called 'pmap_invalidate_ept()'. This routine bumps up the EPT generation number and sends an IPI to the host cpus that are executing the guest's vcpus. On a subsequent entry into the guest it will detect that the EPT has changed and invalidate the mappings from the TLB.
Guest memory access: Since the guest memory is no longer wired we need to hold the host physical page that backs the guest physical page before we can access it. The helper functions 'vm_gpa_hold()/vm_gpa_release()' are available for this purpose.
PCI passthru: Guest's with PCI passthru devices will wire the entire guest physical address space. The MMIO BAR associated with the passthru device is backed by a vm_object of type OBJT_SG. An IOMMU domain is created only for guest's that have one or more PCI passthru devices attached to them.
Limitations: There isn't a way to map a guest physical page without execute permissions. This is because the amd64/pmap code interprets the guest physical mappings as user mappings since they are numerically below VM_MAXUSER_ADDRESS. Since PG_U shares the same bit position as EPT_PG_EXECUTE all guest mappings become automatically executable.
Thanks to Alan Cox and Konstantin Belousov for their rigorous code reviews as well as their support and encouragement.
Thanks for John Baldwin for reviewing the use of OBJT_SG as the backing object for pci passthru mmio regions.
Special thanks to Peter Holm for testing the patch on short notice.
Approved by: re Discussed with: grehan Reviewed by: alc, kib Tested by: pho
show more ...
|
Revision tags: release/9.2.0 |
|
#
552311f4 |
| 17-Jul-2013 |
Xin LI <delphij@FreeBSD.org> |
IFC @253398
|
#
cfe30d02 |
| 19-Jun-2013 |
Gleb Smirnoff <glebius@FreeBSD.org> |
Merge fresh head.
|
Revision tags: release/8.4.0 |
|
#
69e6d7b7 |
| 12-Apr-2013 |
Simon J. Gerraty <sjg@FreeBSD.org> |
sync from head
|
#
66f71b7d |
| 28-Mar-2013 |
Neel Natu <neel@FreeBSD.org> |
Allow caller to skip 'guest linear address' validation when doing instruction decode. This is to accomodate hardware assist implementations that do not provide the 'guest linear address' as part of n
Allow caller to skip 'guest linear address' validation when doing instruction decode. This is to accomodate hardware assist implementations that do not provide the 'guest linear address' as part of nested page fault collateral.
Submitted by: Anish Gupta (akgupt3 at gmail dot com)
show more ...
|